Hey there ....having issues passin a string in my parameter qry.
here is the code
the issus is my strAgntAdd is a date filed and i'm trying to string a between date adn date.
so, if i hover over my strAgntAdd as i'm stepping thru the code it shows "Between 5/1/13 And 5/12/13"
but i get a data type mismatch......so i tried altering the string (from the ParmDate field to be "Between #5/1/13# And #5/12/13#"....same error.
here is the formula for ParmDate:
ParmDate: "Between #" & Format([MaxOfrow_date]+1,"mm/dd/yyyy") & "# And #" & Format(Now()-1,"mm/dd/yyyy") & "#"
any ideas?
thanks
tuk
here is the code
Code:
Dim rsAgntAdd As Recordset
Dim strAgntAdd As String
Dim fldsAgnt As DAO.Fields
Dim fldAgnt As DAO.Field
Set rsAgntAdd = CurrentDb.OpenRecordset("zzzz_qry_MaxDateParmDate")
Set fldsAgnt = rsAgntAdd.Fields
Set fldAgnt = fldsAgnt("ParmDate")
If rsAgntAdd.RecordCount > 0 Then
With rsAgntAdd
.MoveFirst
Do While Not .EOF
strAgntAdd = fldAgnt
Const QRY_APPEND = "zzz_qry_TESTINGPASS"
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
'DoCmd.SetWarnings True
Set db = CurrentDb
'this is the append query which ontain the parameter to gether necessary info
Set qd = db.QueryDefs("zzz_qry_TESTINGPASS")
qd.Parameters(0) = strAgntAdd
'runs the append query to build a running log of data to a defined table
qd.Execute
the issus is my strAgntAdd is a date filed and i'm trying to string a between date adn date.
so, if i hover over my strAgntAdd as i'm stepping thru the code it shows "Between 5/1/13 And 5/12/13"
but i get a data type mismatch......so i tried altering the string (from the ParmDate field to be "Between #5/1/13# And #5/12/13#"....same error.
here is the formula for ParmDate:
ParmDate: "Between #" & Format([MaxOfrow_date]+1,"mm/dd/yyyy") & "# And #" & Format(Now()-1,"mm/dd/yyyy") & "#"
any ideas?
thanks
tuk
Last edited: