DLookup problem

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

Guest

Not sure what I am doing wrong but I am trying to look up an Email address
[Pri-Email] in a table [tblResponsible] based on recordset data. It goes
through a Do loop which works fine. Any ideas what I am doing wrong. TIA


Dim SendTo as String


SendTo = DLookup("Pri-Email", "tblResponsible", "Pri_responsible = " &
rst!Pri_responsible & "'")
 
Not sure what I am doing wrong but I am trying to look up an Email address
[Pri-Email] in a table [tblResponsible] based on recordset data. It goes
through a Do loop which works fine. Any ideas what I am doing wrong. TIA


Dim SendTo as String


SendTo = DLookup("Pri-Email", "tblResponsible", "Pri_responsible = " &
rst!Pri_responsible & "'")

Is Pri_responsible a string value? or numeric? You have a single quote
after the the value but not before.

I'm guessing a string, so try...

DLookup("Pri-Email", "tblResponsible", "Pri_responsible = '" &
rst!Pri_responsible & "'")

- Jim
 
Jim, it is a string. No error but it is not returning the Email address it
returs ""

Any other ideas?

Jim Allensworth said:
Not sure what I am doing wrong but I am trying to look up an Email address
[Pri-Email] in a table [tblResponsible] based on recordset data. It goes
through a Do loop which works fine. Any ideas what I am doing wrong. TIA


Dim SendTo as String


SendTo = DLookup("Pri-Email", "tblResponsible", "Pri_responsible = " &
rst!Pri_responsible & "'")

Is Pri_responsible a string value? or numeric? You have a single quote
after the the value but not before.

I'm guessing a string, so try...

DLookup("Pri-Email", "tblResponsible", "Pri_responsible = '" &
rst!Pri_responsible & "'")

- Jim
 
Did you try Jim's suggestion of fixing the quotes in your statement?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JAdams said:
Jim, it is a string. No error but it is not returning the Email address it
returs ""

Any other ideas?

Jim Allensworth said:
Not sure what I am doing wrong but I am trying to look up an Email address
[Pri-Email] in a table [tblResponsible] based on recordset data. It goes
through a Do loop which works fine. Any ideas what I am doing wrong. TIA


Dim SendTo as String


SendTo = DLookup("Pri-Email", "tblResponsible", "Pri_responsible = " &
rst!Pri_responsible & "'")

Is Pri_responsible a string value? or numeric? You have a single quote
after the the value but not before.

I'm guessing a string, so try...

DLookup("Pri-Email", "tblResponsible", "Pri_responsible = '" &
rst!Pri_responsible & "'")

- Jim
 
Back
Top