J
javablood
Help! I am trying to modify another's code to use a form to input a date
(datbegin) in a query (see below) instead of having to manually change it.
I dimensioned datbegin as Date and set datebegin =
[Forms]![frmMK]![lbodatbegin] and with MsgBox I know that part is working.
However, I get the 3075 error pointing to this:
Set rstMKTable = db.OpenRecordset(strQry)
I did this Dim rstMKTable As DAO.Recordset, hopefully correctly from
postings re error 3061.
strQry = "SELECT ACME.STATION_ID, ACME_PAR.PARAM_NAME, ACME.SAMP_DATE,
ACME.VALUE, ACME.FLAG, ACME.UNITS, " & _
"ACME.QC, ACME.[SELECT], ACME.MEDIUM, IIf([acme].[flag] Like " &
Chr(34) & "*U*" & Chr(34) & ",0.1*[VALUE], [VALUE])" & _
"AS [MK Use Value] FROM MK_Stations INNER JOIN ((ACME INNER JOIN
ACME_PAR ON ACME.PARAM_ID = ACME_PAR.PARAM_ID) " & _
"INNER JOIN MK_PARAM ON ACME_PAR.PARAM_ID = MK_PARAM.PARAM_ID)
ON MK_Stations.STATION_ID = ACME.STATION_ID " & _
" WHERE (((ACME.STATION_ID)=" & Chr(34) & arrWells(i) & Chr(34)
& ") " & _
"AND ((ACME_PAR.PARAM_NAME)=" & Chr(34) & arrParam(j) & Chr(34)
& ") " & _
"AND ((ACME.SAMP_DATE)> #&datbegin&#)) " & _
"AND ((ACME.QC) Not Like " & Chr(34) & "*C*" & Chr(34) & ") " & _
"AND ((ACME.[SELECT])=-1) AND ((ACME.MEDIUM)=" & Chr(34) & "gw"
& Chr(34) & ") " & _
"ORDER BY ACME.STATION_ID, ACME_PAR.PARAM_NAME, ACME.SAMP_DATE; "
Any help for a novice programmer is much appreciated! Thanks,
(datbegin) in a query (see below) instead of having to manually change it.
I dimensioned datbegin as Date and set datebegin =
[Forms]![frmMK]![lbodatbegin] and with MsgBox I know that part is working.
However, I get the 3075 error pointing to this:
Set rstMKTable = db.OpenRecordset(strQry)
I did this Dim rstMKTable As DAO.Recordset, hopefully correctly from
postings re error 3061.
strQry = "SELECT ACME.STATION_ID, ACME_PAR.PARAM_NAME, ACME.SAMP_DATE,
ACME.VALUE, ACME.FLAG, ACME.UNITS, " & _
"ACME.QC, ACME.[SELECT], ACME.MEDIUM, IIf([acme].[flag] Like " &
Chr(34) & "*U*" & Chr(34) & ",0.1*[VALUE], [VALUE])" & _
"AS [MK Use Value] FROM MK_Stations INNER JOIN ((ACME INNER JOIN
ACME_PAR ON ACME.PARAM_ID = ACME_PAR.PARAM_ID) " & _
"INNER JOIN MK_PARAM ON ACME_PAR.PARAM_ID = MK_PARAM.PARAM_ID)
ON MK_Stations.STATION_ID = ACME.STATION_ID " & _
" WHERE (((ACME.STATION_ID)=" & Chr(34) & arrWells(i) & Chr(34)
& ") " & _
"AND ((ACME_PAR.PARAM_NAME)=" & Chr(34) & arrParam(j) & Chr(34)
& ") " & _
"AND ((ACME.SAMP_DATE)> #&datbegin&#)) " & _
"AND ((ACME.QC) Not Like " & Chr(34) & "*C*" & Chr(34) & ") " & _
"AND ((ACME.[SELECT])=-1) AND ((ACME.MEDIUM)=" & Chr(34) & "gw"
& Chr(34) & ") " & _
"ORDER BY ACME.STATION_ID, ACME_PAR.PARAM_NAME, ACME.SAMP_DATE; "
Any help for a novice programmer is much appreciated! Thanks,