470,862 Members | 1,659 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

RunTime error: 3075 - Dlookup Issue

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
3 10969
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

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
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)
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.

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
By using this site, you agree to our Privacy Policy and Terms of Use.