Basic SQL Where question

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

Guest

Hi. I have an unbound listbox on a form, with Rowsource set as:

SELECT [qryServiceContact].[Contact_ID], [qryServiceContact].[CYP_ID],
[qryServiceContact].[Service_Name] FROM qryServiceContact;

I want the listbox to filter based on the "cyp_id" field, using the contents
of a textbox control on the same form (txtCYP_ID). Incredibly simple I know,
but I can't get it to work - it just does'nt seem to pick up the content of
the textbox however i write it.

I can get it to filter if i put in a number (...where [cyp_id] = 100), but
never with using the actual control (...where
[cyp_id]=[forms]![formname]![txtCYP_ID])

Help!
 
What happens when you try?

If you're hoping that typing something into txtCYP_ID will automatically
update the listbox, it won't. You'll need to put

Me!MyListbox.Requery

in the AfterUpdate event of txtCYP_ID.

If you're doing that, and it still doesn't work, show us the actual SQL
you're using.
 
Back
Top