R
RipperT
The following generates an error: "Too few parameters. Expected: 1"
=========start code=============
Dim myFilter as String
Dim strSQL As String
Dim inputDate As String
inputDate = InputBox("Please enter the date in 00/00/00 format: ","Enter
Date")
myFilter = "[HTDate] = Forms![frmPrintHT_SCC]![txtHTDate]"
strSQL = "UPDATE tblInmates INNER JOIN tblSCC ON
tblInmates.InmateId=tblSCC.InmateID " _
& "SET tblSCC.[HTDate] = " & inputDate & " " _
& "WHERE tblSCC.ReleaseDate Is Null And " & myFilter & ";"
Debug.Print "Input date is: " & inputDate
Debug.Print Forms![frmPrintHT_SCC]![txtHTDate]
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError
=========end code==============
The 3 debug statements yield:
Input date is: 10/18/07 '(any test date typed into input box)
10/10/2007
UPDATE tblInmates INNER JOIN tblSCC ON
tblInmates.InmateId=tblSCC.InmateID SET tblSCC.[HTDate] = 10/18/07 WHERE
tblSCC.ReleaseDate Is Null And [HTDate] =
Forms![frmPrintHT_SCC]![txtHTDate];
I've tried putting #'s around the date so it reads #10/18/07#, but
still the error. If I copy this into a query, it works fine, but it
won't work from my code. Help! And thanx!
Rip
=========start code=============
Dim myFilter as String
Dim strSQL As String
Dim inputDate As String
inputDate = InputBox("Please enter the date in 00/00/00 format: ","Enter
Date")
myFilter = "[HTDate] = Forms![frmPrintHT_SCC]![txtHTDate]"
strSQL = "UPDATE tblInmates INNER JOIN tblSCC ON
tblInmates.InmateId=tblSCC.InmateID " _
& "SET tblSCC.[HTDate] = " & inputDate & " " _
& "WHERE tblSCC.ReleaseDate Is Null And " & myFilter & ";"
Debug.Print "Input date is: " & inputDate
Debug.Print Forms![frmPrintHT_SCC]![txtHTDate]
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError
=========end code==============
The 3 debug statements yield:
Input date is: 10/18/07 '(any test date typed into input box)
10/10/2007
UPDATE tblInmates INNER JOIN tblSCC ON
tblInmates.InmateId=tblSCC.InmateID SET tblSCC.[HTDate] = 10/18/07 WHERE
tblSCC.ReleaseDate Is Null And [HTDate] =
Forms![frmPrintHT_SCC]![txtHTDate];
I've tried putting #'s around the date so it reads #10/18/07#, but
still the error. If I copy this into a query, it works fine, but it
won't work from my code. Help! And thanx!
Rip