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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a SQL satement read a combo box?

Status
Not open for further replies.

Saturn87

IS-IT--Management
May 14, 2002
7
US
I trying to make the form where you enter in information user friendly by using combo boxes. I'm trying to use a combo box to look up a user name and then in the field below it to plug in the corresponding user Id and have that user Id entered into the table. I'm not sure if this is possible I was trying to use an SQL statement like so "= SELECT [User Information].[User ID]
FROM [User Information]
Where[User Information].[User ID] = [combo12].[value]; "
I'm not sure if you can even use that combo box in that spot, but I 'm not sure how else to do this. Am I way off? Or is there a better way to do this. I just don't want the user to have to know ever user Id, so I figured they could look it up by the name.
Any help would be appreciated.
Thanks
 
Try
Where[User Information].[User ID] = Forms.Formname. [combo12].[value];
If this is in the form's class module try:

= Me.combo12.value
 
You are close, but .ACTIVE is a waste of typing.

"SELECT [User Information].[User ID]
FROM [User Information]
Where[User Information].[User ID] = '" & combo12 & "'"

will do fine if the bound column in combo12 contains text. However you do not need the single quotes if combo12 contains a number.




( By the way - see the FAQ FAQ700-2190 about )
( avoiding space charachers in object names. )


'ope-that-'elps.

G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top