G
Guest
Hello,
Using Access 2002. Keep getting a syntax error, Missing Operator.
I've tried 3 different versions, reviewed posts here, google searched and
found Ken Snell postings on mcse.ms archives and also reviewed microsoft
article id# 208786
Can someone please help me and tell me what is wrong with this DLOOKUP
statement?
dim temp_ID as string
temp_Status = "Available"
'*** VERSION 1
' temp_ID = DLookup("[ID]", "tbl_Plans", _
'"[DSPLY_CAT_NAME]= '" & Me.cbo_DSPLY_CAT_NAME & "'" & _
'" And [DSPLY_CAT_NAME_1]= " & Me.cbo_DSPLY_CAT_NAME_1 & _
'" And [DSPLY_CAT_NAME_2]= " & Me.cbo_DSPLY_CAT_NAME_2 & _
'" And [DSPLY_CAT_NAME_3]= " & Me.cbo_DSPLY_CAT_NAME_3 & _
'" And [PLAN_NAME]= " & Me.cbo_PLAN_NAME & _
'" And [P2K_SVC_NAME]= " & Me.cbo_PLAN_NAME2) & _
'" And [Status] = '" & temp_Status & "'")
'**** VERSION 2
temp_ID = DLookup("ID", "tbl_Plans", _
"DSPLY_CAT_NAME = """ & Me.cbo_DSPLY_CAT_NAME & """ AND
DSPLY_CAT_NAME_1 = " & _
Me.cbo_DSPLY_CAT_NAME_1 & " AND DSPLY_CAT_NAME_2 = " &
Me.cbo_DSPLY_CAT_NAME_2 & """ DSPLY_CAT_NAME_3 = " & _
Me.cbo_DSPLY_CAT_NAME_3)
'*** VERSION 3
'temp_ID = DLookup("[ID]", "tbl_Plans", _
'"[DSPLY_CAT_NAME]= '" & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME] & "'" & _
'" And [DSPLY_CAT_NAME_1]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_1]
& _
'" And [DSPLY_CAT_NAME_2]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_2]
& _
'" And [DSPLY_CAT_NAME_3]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_3]
& _
'" And [PLAN_NAME]= " & Forms![frm_Check_Out]![cbo_PLAN_NAME] & _
'" And [P2K_SVC_NAME]= " & Forms![frm_Check_Out]![cbo_PLAN_NAME2]) ' & _
'" And [Status] = '" & temp_Status"'")
MsgBox temp_ID
Using Access 2002. Keep getting a syntax error, Missing Operator.
I've tried 3 different versions, reviewed posts here, google searched and
found Ken Snell postings on mcse.ms archives and also reviewed microsoft
article id# 208786
Can someone please help me and tell me what is wrong with this DLOOKUP
statement?
dim temp_ID as string
temp_Status = "Available"
'*** VERSION 1
' temp_ID = DLookup("[ID]", "tbl_Plans", _
'"[DSPLY_CAT_NAME]= '" & Me.cbo_DSPLY_CAT_NAME & "'" & _
'" And [DSPLY_CAT_NAME_1]= " & Me.cbo_DSPLY_CAT_NAME_1 & _
'" And [DSPLY_CAT_NAME_2]= " & Me.cbo_DSPLY_CAT_NAME_2 & _
'" And [DSPLY_CAT_NAME_3]= " & Me.cbo_DSPLY_CAT_NAME_3 & _
'" And [PLAN_NAME]= " & Me.cbo_PLAN_NAME & _
'" And [P2K_SVC_NAME]= " & Me.cbo_PLAN_NAME2) & _
'" And [Status] = '" & temp_Status & "'")
'**** VERSION 2
temp_ID = DLookup("ID", "tbl_Plans", _
"DSPLY_CAT_NAME = """ & Me.cbo_DSPLY_CAT_NAME & """ AND
DSPLY_CAT_NAME_1 = " & _
Me.cbo_DSPLY_CAT_NAME_1 & " AND DSPLY_CAT_NAME_2 = " &
Me.cbo_DSPLY_CAT_NAME_2 & """ DSPLY_CAT_NAME_3 = " & _
Me.cbo_DSPLY_CAT_NAME_3)
'*** VERSION 3
'temp_ID = DLookup("[ID]", "tbl_Plans", _
'"[DSPLY_CAT_NAME]= '" & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME] & "'" & _
'" And [DSPLY_CAT_NAME_1]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_1]
& _
'" And [DSPLY_CAT_NAME_2]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_2]
& _
'" And [DSPLY_CAT_NAME_3]= " & Forms![frm_Check_Out]![cbo_DSPLY_CAT_NAME_3]
& _
'" And [PLAN_NAME]= " & Forms![frm_Check_Out]![cbo_PLAN_NAME] & _
'" And [P2K_SVC_NAME]= " & Forms![frm_Check_Out]![cbo_PLAN_NAME2]) ' & _
'" And [Status] = '" & temp_Status"'")
MsgBox temp_ID