populating a forms based on part number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bubbadump
    New Member
    • Aug 2007
    • 1

    populating a forms based on part number

    I'm new to the forum, but am looking for help trying to populate several text boxes based on a drop down that will choose an asset number.

    my Combo box is named GP, I will pick a number from this list and I want to do a GP_afterupdate( ) to populate description, make, model, sn, etc from a table called GP_Table with fields called description, make, model, sn, etc for the matching gp number.

    I don't have a clue what to do. Can anyone help?
  • BradHodge
    Recognized Expert New Member
    • Apr 2007
    • 166

    #2
    Welcome to thescripts!

    You could put this code in an AfterUpdate event of your combo box, or as the OnClick event of a button on your form...

    Me.make= DLookUp ("[make]", "GP_Table", [gpNumber]= "Forms![YOUR FORM]![GP]"
    Me.model=DLookU p ("[model]", "GP_Table", [gpNumber]="Forms![YOUR FORM]![GP]"
    Me.sn=DLookUp ("[sn]", "GP_Table", [gpNumber]="Forms![YOUR FORM]![GP]"


    and so on...

    Another way to do it might be to just change the recordsource of your form after a gpNumber is chosen.

    Good Luck!

    Brad.

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      Why not simply let Access do all the work? You may have done some of this already.

      Create a form using your table/query as the Record Source.
      Goto the Field List and drag the fields you want retrieved onto the form
      Place a combo box on the form. When the Combobox Wizard comes up:

      Select "Find a record on my form based on the value I've selected..."
      Next
      Select the appropriate identifying field to appear in the Combo box (Your asset number)
      Next
      Size the Combo box column
      Next
      Name the combo box
      Finish

      Now the user can use the dropdown arrow of the combo box to retrieve the data or simply start typing the identifying data in and the combo box will start to autocomplete the entry. When the correct entry is found hit <Enter> and the appropriate data should be retrieved.

      Welcome to theScripts!

      Linq ;0)>

      Comment

      • garethfx
        New Member
        • Apr 2007
        • 49

        #4
        Good rsponse Missingl

        Failing that why not put an an example of where you are up to on here in ZIP and Im sure one or two will make a little exple of the way out for you yo be anle to move on
        G

        Comment

        Working...