Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing control source value to look up items from a combo box

Status
Not open for further replies.
Jun 16, 2005
29
0
0
US
Good morning all, I have a combo box in a form which is set up to look up by serial number:



SELECT [AppleVac_Inv_DB Query].[Serial #] FROM [AppleVac_Inv_DB Query];



Ideally, I'd like to look up by either a serial or a user name. The username field is "users" in the same query. How can I adjust the control source so that I can enter a user name and look up or enter a serial and look up? Is this possible?

Thanks all, this is by far and away the best source for help anywhere.

Thanks in advance!
 
well, a where statement with OR could do that...

WHERE users = blah OR serial = blah...

although you'd want to generate this sql string in the afterupdate event of your search input box and then set this string to the relevant control...

--------------------
Procrastinate Now!
 
Thank you Crowley16 for your quick response. Would I enter that data at the end as this?

SELECT [AppleVac_Inv_DB Query].[Serial #] FROM [AppleVac_Inv_DB Query]WHERE [Users] = "";
 
yes...

but since you don't know the value of input up front, you should use vba to generate the sql string that needs to go into the control source, and then after the user has entered the value, then set the control source...

--------------------
Procrastinate Now!
 
Think it would be possible to give me a boost on the vb? I don't actually code. I normally utilize the controls supplied by access and kind of tweak them a little. So I enter the data [above] into the control source, then I go into vb editor and how do I write it?

Thanks I appreciate your expertise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top