K
Karen
I'm trying to create a record set and am running into errors...
I want this...
Dim rst As DAO.Recordset
Dim MyWksp As Workspace
Dim MyDB As DAO.Database
Dim MySQL As String, MyCriteria As String
Set MyWksp = DBEngine.Workspaces(0)
Set MyDB = MyWksp.Databases(0)
MySQL = "SELECT DISTINCT tblfillrecord.fldproduct,
tblfillrecord.fldlot, tblfillrecord.fldcode,
tblQualityRecord.fldexpiresdate, tblQualityRecord.fldmadedate FROM
tblfillrecord INNER JOIN tblQualityRecord ON (tblfillrecord.fldcode =
tblQualityRecord.fldcode) AND (tblfillrecord.fldlot =
tblQualityRecord.fldlotno) WHERE (((tblfillrecord.fldproduct) Like
[forms]![frm cert dialog box]![text0]) AND (tblfillrecord.fldlot)=
IIf(Len([forms]![frm cert dialog box]![text2])=Val(8)Or
(Len([forms]![frm cert dialog box]![text2])=Val(7) And Mid([forms]![frm
cert dialog box]![text2],4,1)<>'1'),Left([forms]![frm cert dialog
box]![text2],4), Left([forms]![frm cert dialog box]![text2],3)))"
Set rst = MyDB.OpenRecordset(MySQL, dbOpenForwardOnly)
but i get an error about a missing ), ], or ITEM in the expression (and
then the error shows the Where section of the above)
If I try to change this statement so that i'm using where
tblfillrecord.fldproduct like [forms]![frm cert dialog box]![text0])
AND (tblfillrecord.fldlot)= '425' "
I get an error about Too Few Parameters. Expecting 1.
Any ideas where I've gone wrong?
Thanks,
Karen
I want this...
Dim rst As DAO.Recordset
Dim MyWksp As Workspace
Dim MyDB As DAO.Database
Dim MySQL As String, MyCriteria As String
Set MyWksp = DBEngine.Workspaces(0)
Set MyDB = MyWksp.Databases(0)
MySQL = "SELECT DISTINCT tblfillrecord.fldproduct,
tblfillrecord.fldlot, tblfillrecord.fldcode,
tblQualityRecord.fldexpiresdate, tblQualityRecord.fldmadedate FROM
tblfillrecord INNER JOIN tblQualityRecord ON (tblfillrecord.fldcode =
tblQualityRecord.fldcode) AND (tblfillrecord.fldlot =
tblQualityRecord.fldlotno) WHERE (((tblfillrecord.fldproduct) Like
[forms]![frm cert dialog box]![text0]) AND (tblfillrecord.fldlot)=
IIf(Len([forms]![frm cert dialog box]![text2])=Val(8)Or
(Len([forms]![frm cert dialog box]![text2])=Val(7) And Mid([forms]![frm
cert dialog box]![text2],4,1)<>'1'),Left([forms]![frm cert dialog
box]![text2],4), Left([forms]![frm cert dialog box]![text2],3)))"
Set rst = MyDB.OpenRecordset(MySQL, dbOpenForwardOnly)
but i get an error about a missing ), ], or ITEM in the expression (and
then the error shows the Where section of the above)
If I try to change this statement so that i'm using where
tblfillrecord.fldproduct like [forms]![frm cert dialog box]![text0])
AND (tblfillrecord.fldlot)= '425' "
I get an error about Too Few Parameters. Expecting 1.
Any ideas where I've gone wrong?
Thanks,
Karen