Results 1 to 9 of 9
  1. #1
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68

    Dlookup annoying issue

    Hi



    I am trying to use the Dlookup function to put an amountawarded figure in a field on a form, based on a choice of LFURN from a combo box on the same form.

    Here is the code I have used in the 'afterupdate' event on the combo box

    Private Sub LFURN_AfterUpdate()
    AmountAwarded = DLookup("AmountAwarded", "LocalFoodProjects", "LFURN='" & LFURN & "'")

    So essentially, the figure shown in the AmountAwarded field is AmountAwarded figure in the LocalFoodProjects table, based on the LFURN being the same in that table and what is chosen the current form.

    When i run it, it gets no errors, but doesnt do anything, certainly doesnt populate the AmountAwarded box?

    I am sure its just a little tweaking but if anyone can help that would be greeat

    Thanks

    bagpuss

  2. #2
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Try

    Me.AmountAwarded = DLookup("AmountAwarded", "LocalFoodProjects", "LFURN='" & LFURN & "'")

  3. #3
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    Nope, still doesnt do anything sorry.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is the bound column of your ComboBox? Have you put in a breakpoint and hovered over the values to see what you are getting?

  5. #5
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68

    DLookUp

    Aha, I have changed the bound columns value from 1 to 2 (which now would include the AmountAwarded figure

    This seems to have done the trick. Thanks for the tip pointing me in the right direction!

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    What is the name of the combobox?

    Are you getting an error message? Any values?

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help.

  8. #8
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    thansk orange, Rural Guy helped me solve it

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I guess I'm still typing too slow. The question was there, I started to think and write, but got there a little late... again.

    Glad you got it resolved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DLookup issue
    By seth1685 in forum Programming
    Replies: 5
    Last Post: 01-12-2012, 08:55 AM
  2. Easy DLookup Issue
    By Niki in forum Access
    Replies: 7
    Last Post: 05-25-2011, 03:00 PM
  3. Tough form issue that uses DLookup's
    By Solola in forum Forms
    Replies: 3
    Last Post: 03-15-2011, 01:25 PM
  4. annoying error! trust centre?
    By tom4038 in forum Import/Export Data
    Replies: 1
    Last Post: 09-23-2009, 11:26 AM
  5. Annoying Query issue
    By stevendavies in forum Queries
    Replies: 2
    Last Post: 05-08-2006, 02:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums