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

How to pass a variable from form to query?

Status
Not open for further replies.

marks416

IS-IT--Management
Oct 24, 2007
39
CA
Hi

I have a query like

select * from table1 where column1 = "?"

I need pass the ? variale from a form .

Please let me know how to do that?

I also like show the query result on a report.I need a simple tutoral to know this.

Do you have a URL link for this?

Thanks for help

M

 
Set your criteria to [forms]![FormName]![ControlName]

as far as reports go you can get ok results just using the wizard.
 
if your column1 is a stribg, you need:

"select * from table1 where column1 = '" & [forms]![FormName]![ControlName] & "'"

The singe quotes enclose the string value. If it is numeric, you need:

"select * from table1 where column1 = " & [forms]![FormName]![ControlName]

with no quotes.

Dates are even more fun!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top