Search Lookup

Tallica

Registered User.
Local time
Today, 04:12
Joined
Jul 27, 2010
Messages
26
I have a combobox with the which is a lookup and the rowsource is as follows:

SELECT [Contacts Extended].ID, [Contacts Extended].[Contact Name] , [Contacts Extended].[Business Phone], [Contacts Extended].[E-Mail Address]FROM [Contacts Extended] WHERE (([Contacts Extended]![Category]="DPM")) ORDER BY [Contacts Extended].[Contact Name];

It is bound to column 1.

I have a macro which searchs this field and comes up blank when the record is there.

[TempVars]![strFilter] & " OR ([DPM1] Like ""*" & [TempVars]![strSearch] & "*"")"

I need it to search column 1 and not column 0

Can this be done?

TIA
 
Welcome to the forum.

There's no indication of the combo box being used in the search. I don't see the name of the combo box.
 
The Combobox is named DPM1 which is a lookup field in the table which is the datasource for the form.
 
The DPM1 in that code is not for the combo box, it's actually the field. Your macro is getting its value from TempVars. So there must be somewhere where TempVars gets its value.
 
Yes, I have a textbox where a user can enter some text and then search a list of fields for that text. The value of the textbox sets the variable.

DPM1 is one of the fields I want to search. It is a combobox with 4 columns. I want the search to be limited to column 1 whioch is a persons name. column 0 is hidden and is the ID of the record.

Attached is a screenshot
 

Attachments

  • form.jpg
    form.jpg
    100.5 KB · Views: 171
You would need to include the name in the query (i.e. the record source of your form) and change DPM1 in the code to that Person's Name field.
 

Users who are viewing this thread

Back
Top Bottom