Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jun 2010
    Location
    Quincy, MA
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I'm looking to build a form in which once a value from a drop-down box is selected, the next field in the form auto-populates with a predefined value. I'm experiencing a tremendous brain-fart I know, but I am drawing a blank. For anyone who assists, I'm pretty new to Access, so I could use as much detail as possible. Thanks and have a nice weekend. Pete


  2. #2
    Star Lounger
    Join Date
    Sep 2002
    Location
    Hastings, Sussex, England
    Posts
    67
    Thanks
    0
    Thanked 1 Time in 1 Post
    Pete,

    for someone new to access, there are several great sites around (including, of course, this one!). You could do worse than look at Access Archon; Item 6 may be relevant.

    If you want to keep it really simple, in the After Update of the combo box, use:

    If nz(cmbWhatever,0) <> 0 then

    targetcontrolname=DLookup(x,y,z).

    end if

    Dlookup is slow, but relatively easy to use. Check the Help. Just remember that speech marks are needed.

    Or, if the value really is predefined and will not change, replace the DLookup with a Select Case statement.

    Select Case nz(cmbWhatever,0)

    Case x

    targetcontrolname=xxx

    Case y

    targetcontrolname=xyz

    Case Else

    targetcontrolname=null

    End Select

    Regards,

    Jules

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    Quote Originally Posted by Pete Sweeney View Post
    I'm looking to build a form in which once a value from a drop-down box is selected, the next field in the form auto-populates with a predefined value. I'm experiencing a tremendous brain-fart I know, but I am drawing a blank. For anyone who assists, I'm pretty new to Access, so I could use as much detail as possible. Thanks and have a nice weekend. Pete
    In the AfterUpdate event of your combobox, you'd need code. What code depends on the situation. For example, do you want to autopopulate the next field any time the combobox changes, or just when that next fields is null?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Star Lounger
    Join Date
    Jun 2010
    Location
    Quincy, MA
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    JulesG - thank you. I'll work on this as well as the URL you suggest. MarkLiquorman, thank you too.

  5. #5
    Star Lounger
    Join Date
    Jun 2010
    Location
    Quincy, MA
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MarkLiquorman View Post
    In the AfterUpdate event of your combobox, you'd need code. What code depends on the situation. For example, do you want to autopopulate the next field any time the combobox changes, or just when that next fields is null?
    I would want to autopopulate the next field any time the combobox changes; your help is appreciated Pete

  6. #6
    Star Lounger
    Join Date
    Jun 2010
    Location
    Quincy, MA
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Thank you so much for your help; I had some syntax issues with DLOOKUP but have been able to resolve. Please consider this matter closed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •