Ashfaque
Search Beautiful Girls from your town for night
- Local time
- Today, 20:56
- Joined
- Sep 6, 2004
- Messages
- 897
Hello,
I am trying to get proper data thru following recordset line if 2 conditions are true i.e. CDepartment and PWDMger. These both fields are in T_Dept tbl.
But each time it satisfy fisrt condition and for second condition it says "Compile Error - Variable not defined'
Set rst = CurrentDb.OpenRecordset("Select * from T_Dept where CDepartment= '" & Forms!F_EmpOTHeader!EmpDept & "'" And PWDMgr = "Forms!F_EmpOTHeader!OTApprovedBy ", dbOpenDynaset, dbSeeChanges)
Even I tried replacing fields with each others..mean placed first condition at second place and vice versa. This time it stops at second condition with same error.
'Set rst = CurrentDb.OpenRecordset("Select * from T_Dept where PWDMgr= '" & Forms!F_EmpOTHeader!OTApprovedBy & "'" And CDepartment = " & Forms!F_EmpOTHeader!EmpDept & ", dbOpenDynaset, dbSeeChanges)
Both CDepartment and PWDMgr are text fields.
Any perticular reason?
I am trying to get proper data thru following recordset line if 2 conditions are true i.e. CDepartment and PWDMger. These both fields are in T_Dept tbl.
But each time it satisfy fisrt condition and for second condition it says "Compile Error - Variable not defined'
Set rst = CurrentDb.OpenRecordset("Select * from T_Dept where CDepartment= '" & Forms!F_EmpOTHeader!EmpDept & "'" And PWDMgr = "Forms!F_EmpOTHeader!OTApprovedBy ", dbOpenDynaset, dbSeeChanges)
Even I tried replacing fields with each others..mean placed first condition at second place and vice versa. This time it stops at second condition with same error.
'Set rst = CurrentDb.OpenRecordset("Select * from T_Dept where PWDMgr= '" & Forms!F_EmpOTHeader!OTApprovedBy & "'" And CDepartment = " & Forms!F_EmpOTHeader!EmpDept & ", dbOpenDynaset, dbSeeChanges)
Both CDepartment and PWDMgr are text fields.
Any perticular reason?