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

Newbie to Projects: Parameters 1

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
0
0
GB
Hi everyone,

I've spent ages searching through the site for an answer and I'm getting nowhere - so any help appreciated.

I'm manually converting a .mde to a project. However a number of my queries have criteria like:

[Forms]![frmFormName]![txtTextBoxName]

I just can't get my head around this in a project. Something to do with SQL Variables (@MyVariable or something)

Any help appreciated.

Thanks,


Steve.
 
In SQL you have to differentiate between Stored Procedures and Views. Put very simply, a view is a query that doesn't do anything or require any input. That's your typical query.

A stored procedure may accomplish something (like change the content in a table.) or may require parameters, or both. It is like an update query or a parameter query.

If you made a stored procedure that simply needed a parameter and nothing else, you can build it like you would a view and then in the criteria line put in @NameOfVariable.

As you continue you may find that your stored procedures are more complicated than that and you will need to actually code much of it instead of using the builder. Then you have to declare your variables up front and give their datatype much like you would in VBA. But for now, if all you have are queries that look up to a value on a form, the first way I mentioned will work fine.

BUT - SQL won't know to check out a form for a value. When you then use that stored procedure as a recordsource for a form or a report, you will need to feed in the parameter. For instance, if the stored proc is the recordsource for a report, go into the report's properties dialog and set the input parameters value to @nameofvariable = [Form]!. . . .

Hope this helps.
 
Thanks for that belovedcej - worked a treat.

Thanks again,


Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top