Using a combo box in forms

C

Colin Manners

I have a form I'm using in Access that I use for completing work
orders. What I would like to do is create a combo box, which takes
it's data from a Query which has name, address, zip, model & Serial
number in it. You would click on the combo box and it would give you a
drop down list of names, you would select a particular name, which
would then Autocomplete the rest of the information on the form,
filling in the Address, zip, model & Serial number.
I have tried everything, but I can't get the form to autocomplete.
Anyone got any ideas.
Thanks.
 
J

Jim Allensworth

I have a form I'm using in Access that I use for completing work
orders. What I would like to do is create a combo box, which takes
it's data from a Query which has name, address, zip, model & Serial
number in it. You would click on the combo box and it would give you a
drop down list of names, you would select a particular name, which
would then Autocomplete the rest of the information on the form,
filling in the Address, zip, model & Serial number.
I have tried everything, but I can't get the form to autocomplete.
Anyone got any ideas.
Thanks.

OK, your combo box has 5 columns (assuming model & serial number are
different columns). Set your other textboxes based on these columns.
In the After Update event something like this...

Me.txtAddress = Me.cboCombo.Column(1)
Me.txtZip = Me.cboCombo.Column(2)
Me.txtModel = Me.cboCombo.Column(3)
Me.txtSerialNum = Me.cboCombo.Column(4)

Note that the column index is zero based, so 5 columns goes from 0-4

I'm assuming that you would leave the combo for the Name display.

- Jim
 
A

Art

Hi Colin

This works for me. You might give it a try. You will need
to change the names to fit your situation. I use a generic
name(txtText etc) for the controls that I need to autofill
to make it easier to code. Also remember that the sql for
the combo box is zero based. What humans would consider
column 1 is, in access, column 0.

Private Sub cboDept_AfterUpdate()

Dim intI As Integer

For intI = 2 To 5
Me("txtText" & intI) = cboDept.Column(intI)
Next intI

Me.Requery


End Sub

HOPE THIS HELPS
 

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

Top