468,557 Members | 2,504 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,557 developers. It's quick & easy.

RunTime error: 3075 - Dlookup Issue

29
Hello Experts,

I'm about to go grey with this dlookup statement:

I'm trying to run a dlookup statement, I have the correct expression string, etc. but when I run it under the Immediate window for testing I'm getting the runtime error.

Scanerio:

I'm calling an associated Price value (Currency) for a Code (text) from a Query in order to have an auto population in the fields; here is the code:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub CPTcode_AfterUpdate()
  2.     Charge = DLookup("Charge", "Q_CPT-phys test1", "CPTcode= '& CPTcode'")
  3. End Sub 
It only populates if i replace the "& CPTcode" with an actual value. This is pulling from the same Subform.

Please Help

Adigga1
Nov 14 '08 #1
3 10415
Try this instead.

Expand|Select|Wrap|Line Numbers
  1. Charge = DLookup("Charge", "Q_CPT-phys test1", "CPTcode= '" & CPTcode & "'")
I have issues with DLookups too, it's not just you =)
Nov 14 '08 #2
adigga1
29
mandanarchi,


Thank you for your suggestion; I will try this code and follow-up with the results.

Adigga1


It ran Successfully!! Thank you
Nov 14 '08 #3
missinglinq
3,532 Expert 2GB
Is CPTcode a Text or Numeric Datatype? The syntax varies accordingly.

For Numeric CPTcode:
Expand|Select|Wrap|Line Numbers
  1. Me.Charge = DLookup("Charge", "Q_CPT-phys test1", "CPTcode= "& Me.CPTcode)
  2.  
For Text CPTcode:
Expand|Select|Wrap|Line Numbers
  1. Me.Charge = DLookup("Charge", "Q_CPT-phys test1", "CPTcode = '" & Me.CPTcode & "'")
  2.  
Welcome to Bytes!

Linq ;0)>
Nov 14 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by khan | last post: by
3 posts views Thread by injanib via AccessMonster.com | last post: by
1 post views Thread by BobbyDazzler | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.