• How To Default Information On Form?

    Author
    Topic
    #470684

    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

    Viewing 3 reply threads
    Author
    Replies
    • #1236936

      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:

      [indent]If nz(cmbWhatever,0) 0 then

      [indent][/indent][indent][/indent]targetcontrolname=DLookup(x,y,z).

      end if[/indent]

      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.

      [indent]Select Case nz(cmbWhatever,0)

      Case x

      [indent][/indent]targetcontrolname=xxx

      Case y

      [indent][/indent]targetcontrolname=xyz

      Case Else

      [indent][/indent]targetcontrolname=null

      End Select[/indent]

      Regards,

      Jules

    • #1236937

      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?

      • #1236989

        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

    • #1236954

      JulesG – thank you. I’ll work on this as well as the URL you suggest. MarkLiquorman, thank you too.

    • #1237201


      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.

    Viewing 3 reply threads
    Reply To: How To Default Information On Form?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: