List Updates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Query No 2

On my clients for i have a search box which filters a list box below it,
according to text entered. What i want the list box to show is active
clients only. I know a little about the VB Code and still learning but cant
get this to work.

Here is the Code

Private Sub Search_Exit(Cancel As Integer)
Me.List.RowSource = "SELECT Client.ClientID, Client.Surname, Client.First,
Client.Active FROM Client WHERE (((Client.Surname) Like '*" & Me.Search &
"*') AND ((Client.Active)=yes)) ORDER BY Client.Surname"
End Sub

After this staff select a client which then updates the fields on the rest
of the form.

What needs to be changed in my current code

Thanks
 
By "search box " do you mean a combo box?

I would use the After update event, but I think the answer to your problem
is setting the recordsource dowsn't requery the list box.

Try this:

'----beg code -----------
Private Sub Search_Exit(Cancel As Integer)
Me.List.RowSource = "SELECT Client.ClientID, Client.Surname,
Client.First, Client.Active FROM Client WHERE (((Client.Surname) Like '*" &
Me.Search & "*') AND ((Client.Active)=yes)) ORDER BY Client.Surname"

' now requery the list box
Me.List.Requery

End Sub
'----end code-------------


HTH
 

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

Similar Threads

Searching 2
Search Box 2
update form after adding to combo box 20
combo form filter 2
'Enter parameter value' message 1
Open for to Edit or Add Record 6
Filtering a List Box 8
Combo Box Subform 11

Back
Top