Data not refreshing

K

Kelly

I hope I can explain this problem! This just started occurring when I
switched to Office 2007.

I have a form that contains information for customers. I often want to
retrieve all data for one particiular customer.

I have a drop down box with the customer id. I select a customer id and
that runs a macro to filter the records based on that customer id.

Works like a charm the FIRST time (and worked like a charm in previous
versions of Access). However, if I attempt to pull up a different
customer, it retrieves the first customer again. To pull up a different
customer, I have to close/reopen the form.

For instance:
I want to view records for ABC customer. I select ABC in the drop down and
the records are filtered to ABC.
Now I want to see XYZ, I select XYZ in the drop down, XYZ appears (I've even
tried setting up a dummie field to double check the value being saved and it
is definitely XYZ). The records filter to ABC.
I toggle/untoggle the filter --- still ABC
I try a different company - Joe's Plumbing -- still ABC.

I've been using this same form since 2000 in various versions of word.
Never had a problem til I switched to 2007
 
K

Kelly

It's a one line macro

ApplyFilter
Where [Client ID]=[Forms]![Form Name]![Lookup]

For trouble shooting, I've added a separate field so I can see what's being
stored in [Forms]![Form Name]![Lookup] and IT is changing. It will say
"XYZ Company", but still filter to the records for the first client ID that
was searched.

I really need to use a filter rather than a find because I flip back and
forth between records alot.
 
A

Allen Browne

Private Sub Lookup_AfterUpdate()
Dim strWhere As String

If Me.Dirty Then Me.Dirty = False

If IsNull(Me.Lookup) then
Me.FilterOn = False
Else
strWhere = "[Client ID] = " & Me.Lookup
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top