Access forms fill in

B

Buckie

I am trying to create a form that will have fields such as customer name,
address, city, zip....I want the form to automatically populate the address,
city and zip fields when I choose the Customer name from the drop down box...
 
L

Linq Adams via AccessMonster.com

Set up your combobox using the wizard and include the fields you need, i.e.
CustomerName, Address, City, State, Zip, etc. If the fields are added to the
combobox in that order, then the syntax would be

Private Sub YourComboBox_AfterUpdate()
Me.CustomerName= Me.YourComboBox.Column(0)
Me.Address = Me.YourComboBox.Column(1)
Me.City = Me.YourComboBox.Column(2)
Me.State = Me.YourComboBox.Column(3)
Me.Zip = Me.YourComboBox.Column(4)
End Sub

Notice that the column index is zero based.
 
M

MikeJohnB

Cannot better linq's answer but just adding that you don't have to display
all the fields in your combo box if you feel you don't want all those columns
visible, you can make the ones you don't really want the user to see, zero
width.

3.122cm;3.466cm;3.784cm;3.202cm (This is typical widths of four columns)

Setting
3.122cm;3.466cm;0cm;0cm

Will hide the last two columns.

Sorry if I have overcomplicated the response.

Kindest Regards

Mike B
 
D

DataGopherDan

My only question to this would are you just using these as temporary fields
on the form for display purposes or is the data being populated into another
table? If it's the latter, it sounds like you might be capturing the same
data that you have in another table, which you shouldn't have to do.
Cannot better linq's answer but just adding that you don't have to display
all the fields in your combo box if you feel you don't want all those columns
visible, you can make the ones you don't really want the user to see, zero
width.

3.122cm;3.466cm;3.784cm;3.202cm (This is typical widths of four columns)

Setting
3.122cm;3.466cm;0cm;0cm

Will hide the last two columns.

Sorry if I have overcomplicated the response.

Kindest Regards

Mike B
Set up your combobox using the wizard and include the fields you need, i.e.
CustomerName, Address, City, State, Zip, etc. If the fields are added to the
[quoted text clipped - 9 lines]
Notice that the column index is zero based.
 

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