Parameters Again??

  • Thread starter Thread starter Kahuna
  • Start date Start date
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.
 
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""
 
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.
 
Back
Top