• Filter stops fields being updateable (Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Filter stops fields being updateable (Access 2003)

    Author
    Topic
    #431752

    Perhaps I’m being thick – but I had a simple little edit form that used a data source ‘select * from Individual’ and provided edit functionality to the fields such as name and address.

    I wanted to, on the same form, alloweentry of a lookup value. So I created an unbound label ‘lookfor’ and coded the following event on exit

    Private Sub Lookfor_Exit(Cancel As Integer)
    Me.Filter = “((IndividualId = ” & Me.Lookfor & “))”
    Me.FilterOn = True
    End Sub

    It does exactly what I want, displaying the correct record for the individual with that Id. However, it also makes the form uneditable which is NOT what I want. (The only field that gets the focus is Lookfor.)

    Is there a way of allowing field updates within this filtered form – or should I be doing this in an entirely different way?
    Andrew

    Viewing 0 reply threads
    Author
    Replies
    • #1011222

      Don’t use the On Exit event of the text box for this, but use the After Update event instead. The On Exit event and moving to another record interfere with each other, effectively locking you into the Lookfor text box.

      • #1011240

        Hansv

        Thankyou for both the reply and its speed and accuracy – another step forward grin that seems to work very.
        I’m now happily editting – but when I go to save I get a message saying that the record is locked by another user (it isn’t)
        I’m obviously now missing something else – any ideas?

        Andrew

        • #1011242

          Does this only happen if you have used the Lookfor text box? Or does it also occur if you use the navigation buttons to go to a record?

          • #1011244

            The form now has a filter permanently set and when it is invoked a second time, the result is a filter is on with no selected records, so I cannot check it by record selection. Before I coded Lookfor though, updates could be done
            Andrew

            • #1011248

              I don’t think the After Update code of the Lookfor text box causes the problem. I don’t think we can offer further help without seeing the database. Could you post a stripped down copy of your database? See post 401925 for instructions.

            • #1011254

              OK – thanks
              Its running on an ODBC connection into SQL server so I’ll make a local version of the table – if I’m dead unlucky, presumably it will fix the problem grin
              Rats – it did so I cannot demonstrate.

    Viewing 0 reply threads
    Reply To: Filter stops fields being updateable (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: