DLookup help needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aharding
    New Member
    • Sep 2006
    • 22

    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]", "Calcluatio n 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.NT G (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]", "Calcluatio n 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.NT G.

    = DLookup("[NTG]", "Calcluatio n 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
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Originally posted by aharding
    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]", "Calcluatio n 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.NT G (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]", "Calcluatio n 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.NT G.

    = DLookup("[NTG]", "Calcluatio n 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.

    Comment

    Working...