By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

RunTime error: 3075 - Dlookup Issue

P: 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.


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

Nov 14 '08 #1
Share this Question
Share on Google+
3 Replies

P: 90
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

P: 29

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


It ran Successfully!! Thank you
Nov 14 '08 #3

Expert 2.5K+
P: 3,532
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)
For Text CPTcode:
Expand|Select|Wrap|Line Numbers
  1. Me.Charge = DLookup("Charge", "Q_CPT-phys test1", "CPTcode = '" & Me.CPTcode & "'")
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.