SQL Pass through form variables

petebob796

Registered User.
Local time
Today, 00:52
Joined
Jul 31, 2007
Messages
27
I know this is probably obvious but how do I pass through form variables to sql server I currently have:

exec QStudent @_param_cmbYear="0708", @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"

this executes correctly SelID being a student ID or partial ID also allowing for surname forename partial search. I thought it would just be:

exec QStudent @_param_cmbYear=[Forms]![Attendance and Lateness Main]![cmbYear], @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"


to switch acad year to a form variable and repeat for the others but it errors on trying to save the pass through. Thanks for the help.
 
I think I can do it in code like this:

temp = "QStudent " & [Forms]![Attendance and Lateness Main]![cmbYear] & "," & _
[Forms]![FStudent]![Sel_ID] & "," & [Forms]![FStudent]![Sel_Forename] & "," & _
[Forms]![FStudent]![Sel_Surname]

Set rsRDC = dbRDC.OpenRecordset(temp, dbOpenSnapshot, dbSQLPassThrough)

but then how would I set the report recordsource to rsRDC
 

Users who are viewing this thread

Back
Top Bottom