I am trying to pass a txt box value to a report so that I can dynamically print a report that displays the records that are equal to SQLtest in the below code. I presume I can use a standard report, and then pass field values so that only certain values from table are reported on. No luck yet with my shoddy code, any ideas??
Private Sub cmd_PrintRGCBoxReport_Click()
SQLtest = "Where RGCBoxNumber =" & Me.[txt_RGC_BoxNumber_unbound] & ";"
Dim rsreport As DAO.Recordset ' requires DAO reference
'assumes number data type for Abbot_PID
Set rsreport = CurrentDb.OpenRecordset( _
"Select * From tbl_Validation_data " & SQLtest)
DoCmd.OpenReport "report_tbl_Validation_data", acNormal, rsreport
rsreport.Close
Set rsreport = Nothing
End Sub
Private Sub cmd_PrintRGCBoxReport_Click()
SQLtest = "Where RGCBoxNumber =" & Me.[txt_RGC_BoxNumber_unbound] & ";"
Dim rsreport As DAO.Recordset ' requires DAO reference
'assumes number data type for Abbot_PID
Set rsreport = CurrentDb.OpenRecordset( _
"Select * From tbl_Validation_data " & SQLtest)
DoCmd.OpenReport "report_tbl_Validation_data", acNormal, rsreport
rsreport.Close
Set rsreport = Nothing
End Sub