Missing operator

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

Hi all,
I have this code for a cboBox..

Private Sub cboIssue_AfterUpdate()

Dim strRez As Variant

strRez = DLookup("[resolution]", "qryRez", "[Issue]=" &
Forms!frmsprt!cboIssue)

If IsNull(strRez) Then
Me.txtDetail.Visible = True
Me.sfmResolution.Visible = False
Else
Me.txtDetail.Visible = False
Me.sfmResolution.Visible = True
End If

Me.sfmResolution.Requery

End Sub

...but when I try to run it, it complains about a missing
operator. I have tried to work exactly what is missing
but to no avail. Can some see my coding error.
I'm running WinXP, AccessXP.

Thanks in advance,
Craig....
 
Is Issue a text field? If so:

strRez = DLookup("[resolution]", "qryRez", "[Issue]='" &
Forms!frmsprt!cboIssue & "'")

Date field:
strRez = DLookup("[resolution]", "qryRez", "[Issue]=#" &
Forms!frmsprt!cboIssue & "#")

Numeric: What you have will work

Chris Nebinger
 
Thanks Chris, yes, the issue field is a text field,
however, running this now it errors this message...

Runtime error 2001
You cancelled the previous operation.
-----Original Message-----
Is Issue a text field? If so:

strRez = DLookup("[resolution]", "qryRez", "[Issue]='" &
Forms!frmsprt!cboIssue & "'")

Date field:
strRez = DLookup("[resolution]", "qryRez", "[Issue]=#" &
Forms!frmsprt!cboIssue & "#")

Numeric: What you have will work

Chris Nebinger
-----Original Message-----
Hi all,
I have this code for a cboBox..

Private Sub cboIssue_AfterUpdate()

Dim strRez As Variant

strRez = DLookup("[resolution]", "qryRez", "[Issue]=" &
Forms!frmsprt!cboIssue)

If IsNull(strRez) Then
Me.txtDetail.Visible = True
Me.sfmResolution.Visible = False
Else
Me.txtDetail.Visible = False
Me.sfmResolution.Visible = True
End If

Me.sfmResolution.Requery

End Sub

...but when I try to run it, it complains about a missing
operator. I have tried to work exactly what is missing
but to no avail. Can some see my coding error.
I'm running WinXP, AccessXP.

Thanks in advance,
Craig....
.
.
 
The 2001 error with a DLookup domain function usually means that the
function cannot find one of the fields, query/table, and/or form control as
you have named them. Check your spellings to be sure all is copacetic.
--

Ken Snell
<MS ACCESS MVP>

Mitch said:
Thanks Chris, yes, the issue field is a text field,
however, running this now it errors this message...

Runtime error 2001
You cancelled the previous operation.
-----Original Message-----
Is Issue a text field? If so:

strRez = DLookup("[resolution]", "qryRez", "[Issue]='" &
Forms!frmsprt!cboIssue & "'")

Date field:
strRez = DLookup("[resolution]", "qryRez", "[Issue]=#" &
Forms!frmsprt!cboIssue & "#")

Numeric: What you have will work

Chris Nebinger
-----Original Message-----
Hi all,
I have this code for a cboBox..

Private Sub cboIssue_AfterUpdate()

Dim strRez As Variant

strRez = DLookup("[resolution]", "qryRez", "[Issue]=" &
Forms!frmsprt!cboIssue)

If IsNull(strRez) Then
Me.txtDetail.Visible = True
Me.sfmResolution.Visible = False
Else
Me.txtDetail.Visible = False
Me.sfmResolution.Visible = True
End If

Me.sfmResolution.Requery

End Sub

...but when I try to run it, it complains about a missing
operator. I have tried to work exactly what is missing
but to no avail. Can some see my coding error.
I'm running WinXP, AccessXP.

Thanks in advance,
Craig....
.
.
 
Back
Top