how to select from a table and fill in other data in access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

my problem- i have a table of customer names , addresses , postcodes etc ,
now in my form i have created 1 combo box to select the customer name - this
works fine but once i have selected the name i want to automatically fill in
postcodes addresses that go with that customers name , please someone help
iam going insane haha thankyou--- RG
 
A combo box can have more than one piece of information for each row. This
is done by selecting a RowSource that returns multiple fields.

Once you've done that, in the AfterUpdate event of the combo box, you can
put code that refers to the additional columns (whether or not they're
visible in the combo box), and assign their values to text boxes:

Private Sub MyCombobox_AfterUpdate()

Me!txtAddress = Me!MyCombobox.Column(1)
Me!txtPostCode = Me!MyCombobox.Column(2)

End Sub

This assumes that the address is the 2nd column and the postcode the 3rd
column (the Column collection starts numbering at 0)
 
i think i understand what your saying iam quite new to access so forgive my
stupidity but how do i create the source that returns multiple fields ?
 
Set the RowSource for the combo box a query that returns the necessary
fields.

Set the combo box's ColumnCount property appropriately.

To control which columns are visible, use the ColumnWidths property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top