Results 1 to 3 of 3
  1. #1
    daniel.preda is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Montreal
    Posts
    11

    Question Dlookup in form doesn't work when I validate a defaultvalue from previous record

    I am using in the form the folowing code:


    Private Sub Store_AfterUpdate()
    Me![Store].DefaultValue = Me![Store].Value
    Me![Manager] = DLookup("Manager", "Actual Managers", "Store = " & Me![Store])
    End Sub
    I need the number of the store to be automaticly updated after the last record i entered, then the manager name looked up after the store number.

    This works like a charm only when i type the store number... when i use the last record store number (it is completed automaticly as I wanted, I just hit Enter), the dlookup doesn't work anymore...

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do not get an AfterUpdate event if nothing has been changed. You may want to put your code in the OnExit event of the control instead.

  3. #3
    daniel.preda is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Montreal
    Posts
    11

    thanks

    you're right... thanks... i'm new in access... but i'm beginning to figure it out..

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

Similar Threads

  1. Replies: 2
    Last Post: 11-02-2009, 10:14 PM
  2. Populate date from previous record
    By Lianes in forum Access
    Replies: 3
    Last Post: 09-19-2009, 03:42 PM
  3. Add data from previous record if blank
    By mbc321 in forum Queries
    Replies: 1
    Last Post: 08-08-2009, 05:15 PM
  4. using value from previous record
    By dollars in forum Queries
    Replies: 0
    Last Post: 12-10-2008, 03:30 PM
  5. Replies: 1
    Last Post: 01-10-2006, 12:32 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