Fill one control based on content of second control/Retrieve records with combobox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Marks
    New Member
    • Dec 2007
    • 21

    Fill one control based on content of second control/Retrieve records with combobox

    Hi there I'm trying to do two things using Access 2000 hopefully someone can help me with it.

    1. Using Access Forms if i enter a number in a textboxfield (Named "A") that in another textbox field it will automatically load for example a piece of text which says BETA in field (Named "B")

    2. Using Access Forms, What VB Code could I use that will load the first colum of a table (The Primary Key for this example) in a drop down menu, when I click on it it will load up the record with other information on it. Instead of using the (Next, Previous and Find) Buttons.

    Hopefully this makes sense.
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    1. Using Access Forms if i enter a number in a textboxfield (Named "A") that in another textbox field it will automatically load for example a piece of text which says BETA in field (Named "B")

    [CODE=vb]Private Sub A_AfterUpdate()
    Select Case A
    Case 1
    Me.B = "Alpha"

    Case 2
    Me.B = "Beta"

    End Select

    End Sub
    [/CODE]

    2. Using Access Forms, What VB Code could I use that will load the first colum of a table (The Primary Key for this example) in a drop down menu, when I click on it it will load up the record with other information on it. Instead of using the (Next, Previous and Find) Buttons

    Add a combo box to your form. The Combobox Wizard will pop up

    Select "Find a record based on the value I selected in my combobox."

    From the query/table the form is based on, click on the field you're searching by (your PK field) to move it to the right side.

    Hit Next.

    Size the column appropriately.

    Hit Next.

    Name the combobox.

    Hit Finish.

    Now you can drop the combobox down and scroll down to the item to search by, or you can start to enter the item, and the combobox will "autofill" as you type. Hit <Enter> and the record will be retrieved.

    Welome to TheScripts!

    Linq ;0)>

    Comment

    • Marks
      New Member
      • Dec 2007
      • 21

      #3
      Thanks worked like a charm. Just preparing for the next part of my script :)

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Glad we could help!

        Linq ;0)>

        Comment

        Working...