Parameters Again??

K

Kahuna

Hi Folks - as usual a simple one that's fried my brain!

Have a SQL string I'd like to use as a recordsource for a Report (in
OnOpen). Works fine except for the parameters where the SQL looks for
entries on an open form.

What's the syntax to define the parameters, considering I am intending to
simply make the SQL the recordsource, i.e.

Me.recordsource = strSQL

Help appreciated.
 
J

JohnFol

If you are making the recordsource, why not concatenate in the form values?
ie

strSQL = "Select * from Mytable where [FieldA]=" & Forms!FormName!FieldName
& " Order by fieldB""
 
K

Kahuna

Wot A Star

Believe it or not but I had assigned variable to the form values and
inserted the variables into the sql string. Guess what? I forgot to split
the text from the variable so in effect I had:

strSQL = "Select * from Mytable where [FieldA]= &
Forms!FormName!FieldName & Order by fieldB""

which will not work (of course).

Thanks John - I said it would be simple - fried brain and all!

Cheers

--
Kahuna
------------
JohnFol said:
If you are making the recordsource, why not concatenate in the form values?
ie

strSQL = "Select * from Mytable where [FieldA]=" & Forms!FormName!FieldName
& " Order by fieldB""

Kahuna said:
Hi Folks - as usual a simple one that's fried my brain!

Have a SQL string I'd like to use as a recordsource for a Report (in
OnOpen). Works fine except for the parameters where the SQL looks for
entries on an open form.

What's the syntax to define the parameters, considering I am intending to
simply make the SQL the recordsource, i.e.

Me.recordsource = strSQL

Help appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top