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

How do I pass form parameteres to Queries? 1

Status
Not open for further replies.

liamlaurent

IS-IT--Management
Oct 30, 2006
30
DM
Hello all,

I would like to know if it is possible to pass the contents of a TextBox or the selected value in a ComboBox as a parameter to a query. If it is possible I would appreciate an example of the SQL syntax that does this.


Thanks
Liam

 
Something like....
If Field1 is numeric --
"SELECT Field1, Field2 FROM Table1 WHERE Field1 = " & Forms!FormName!ControlName
If Field1 is text --
"SELECT Field1, Field2 FROM Table1 WHERE Field1 = '" & Forms!FormName!ControlName & "'"

If Field1 is a date --
SELECT Field1, Field2 FROM Table1 WHERE Field1 = #" & Forms!FormName!ControlName & "#"


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top