DLookup Syntex

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could someone tell me what I'm not doing right here??

Dim strEmail As String
Dim strReviewer As String

strReviewer = Me.txtReviewer

Me.txtReviewer.Enabled = True
strEmail = DLookup("", "qryMKEmail", "[ID]=" & strReviewer)

DoCmd.SendObject acSendNoObject, , , strEmail, , "Return Tracker"

Me.txtReviewer.Enabled = False
 
Could someone tell me what I'm not doing right here??

If strReviewer is a string (which it seems to be by the name)
you need single quotes around it:

strEmail = DLookup("", "qryMKEmail", "[ID]='" & strReviewer & "'")

Tom Lake
 
Not sure where the problem is occuring,
As Tom said, a string needs quotes.
But, is txtReviewer As String?
and is ID a string?
If not, then strReviewer should become intReviewer etc..

Tom Lake said:
Could someone tell me what I'm not doing right here??

If strReviewer is a string (which it seems to be by the name)
you need single quotes around it:

strEmail = DLookup("", "qryMKEmail", "[ID]='" & strReviewer & "'")

Tom Lake
[/QUOTE]
 
Back
Top