I have code that works when i run the query by itself. When i convert the code to VBA i get the Error "3061 too few parameters. Expected 1." The error shows up on the OpenRecordset line.I have tried calling the qry but that gives the same error. I know there is something small that i am missing. Could someone please look at my code and explain what i am doing wrong. Thank you in advance.
V/R
Walker
Code:
Private Sub btnInProc_Click()
'On Error GoTo EH
Dim sSql As String
Dim Var_Date As Date
Var_Date = DMax("TestedDate", "tbl_343sTested")
Debug.Print "<" & Var_Date & ">"
DoCmd.Hourglass True
' sSql = "qry_Recall"
sSql = "SELECT tbl_343sTested.FixturePosition, tbl_343sTested.SerialNumber, tbl_343sTested.TestedDate, tbl_343sTested.Technician, "
sSql = sSql & " tbl_343sTested.TankTestedIn, tbl_343sTested.LoadTested, tbl_343sTested.PrePressureReading, tbl_343sTested.PrePressureUnits, tbl_343sTested.PreReading, "
sSql = sSql & " tbl_343sTested.HighPressureReading, tbl_343sTested.HighPressureUnits, tbl_343sTested.HighReading, tbl_343sTested.PostPressureReading, "
sSql = sSql & " tbl_343sTested.PostPressureUnits, tbl_343sTested.PostReading, tbl_343sTested.Recheck, tbl_343sTested.PassFail, tbl_343sTested.Tr343Id, "
sSql = sSql & " tbl_343sTested.MeggerID, tbl_343sTested.PressureIndID, tbl_343sTested.Comment "
sSql = sSql & " FROM tbl_343sTested "
sSql = sSql & " WHERE (((tbl_343sTested.TestedDate)=[Var_Date]) AND ((tbl_343sTested.LoadTested)=DMax('LoadTested','tbl_343sTested','[tbl_343sTested.TestedDate]=#' & [Var_Date] & '#')))"
Debug.Print sSql
Set dbTest = CurrentDb
Set rstTestData = dbTest.OpenRecordset(sSql)