471,355 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 software developers and data experts.

DLookup help needed

Hello!

I am using Access 2003

I have been playing with DLookup all morning and have not been successful yet. I have never used this function...and have some limited experience with code. I will post what I have tried so far and hopefully someone can help me problem solve.


I have tried three different methods... (I know Calculation is spelled wrong..I have to go through my database and fix it everywhere just haven't had the time yet...)


1. I attempted to put the following code in the control box of an unbound text box to pull the correct NTG. No luck

= DLookup("[NTG]", "Calcluation Lookup Table TEST", "[num] = " _& Forms![Add New Subs]![num])


2. I attempted to put the following code in the before update event of a textbox bound to subfunctions.NTG (the field I want the value to store in). I took the sample code from the help function and adapted it to my database...

[code]
Dim varX As Variant
varX = DLookup("[NTG]", "Calcluation Lookup Table TEST", "[num] = " _
& Forms![Add New Subs]![num])
[code]

3. I attempted to put the following code in the record source of a textbox bound to subfunctions.NTG.

= DLookup("[NTG]", "Calcluation Lookup Table TEST", "[Me]![num] = " _ &
Forms![Add New Subs]![num])


What am I missing? I do not have an experience with DLookup...can someone help me?


The goal is to have the "library" value from [Calcluation Lookup Table TEST].[NTG] populate in the NTG field in a form (form filtered by [num] field based on previous form) and be able to revise and store it in [Subfunctions].[NTG]
I have tried pulling it in as default as well but no luck.

I am not getting any error messages, nothing appears in the textbox.

Thanks,
Annemarie
Nov 28 '06 #1
1 1668
NeoPa
32,405 Expert Mod 16PB
Hello!

I am using Access 2003

I have been playing with DLookup all morning and have not been successful yet. I have never used this function...and have some limited experience with code. I will post what I have tried so far and hopefully someone can help me problem solve.


I have tried three different methods... (I know Calculation is spelled wrong..I have to go through my database and fix it everywhere just haven't had the time yet...)


1. I attempted to put the following code in the control box of an unbound text box to pull the correct NTG. No luck

= DLookup("[NTG]", "Calcluation Lookup Table TEST", "[num] = " _& Forms![Add New Subs]![num])


2. I attempted to put the following code in the before update event of a textbox bound to subfunctions.NTG (the field I want the value to store in). I took the sample code from the help function and adapted it to my database...

[code]
Dim varX As Variant
varX = DLookup("[NTG]", "Calcluation Lookup Table TEST", "[num] = " _
& Forms![Add New Subs]![num])
[code]

3. I attempted to put the following code in the record source of a textbox bound to subfunctions.NTG.

= DLookup("[NTG]", "Calcluation Lookup Table TEST", "[Me]![num] = " _ &
Forms![Add New Subs]![num])


What am I missing? I do not have an experience with DLookup...can someone help me?


The goal is to have the "library" value from [Calcluation Lookup Table TEST].[NTG] populate in the NTG field in a form (form filtered by [num] field based on previous form) and be able to revise and store it in [Subfunctions].[NTG]
I have tried pulling it in as default as well but no luck.

I am not getting any error messages, nothing appears in the textbox.

Thanks,
Annemarie
In 1 try
= DLookup("[NTG]", "[Calcluation Lookup Table TEST]", "[num] = " & Forms![Add New Subs].[num])
If that doesn't work I'd suggest that the form of the DLookup() function is not your problem.
Check spellings and all syntax.
Nov 29 '06 #2

Post your reply

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

Similar topics

1 post views Thread by ogilby1 | last post: by
5 posts views Thread by Kalvin Schroder | last post: by
6 posts views Thread by Don Sealer | last post: by
13 posts views Thread by nzyui | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.