Full Version: Trouble auto populating controls on form from combo box, sample
UtterAccess Forums > Microsoft® Access > Access Forms
earthenfairie
I'm having trouble with a combo box that won't populate the resulting fields with information listed the combo box. I would like to have if fill in contact information when a vendor name is chosen. Thanks for the help. DB attached
earthenfairie
Any suggestions???
Larry Larsen
Hi
Which form..??
thumbup.gif
earthenfairie
The purchase order form...vendor address and contact info...
Larry Larsen
Hi
I like to push the data into the control using the click event of the combo..
eg:
CODE
Private Sub Combo37_Click()
Me.VendorAddress = Me.Combo37.Column(2)
End Sub

Here I'm putting the column value(2) of the combo into the form control called Me.VenderAddress.
Just repeat for all the other columns of data..
Note: Column references start at (0),(1),(2),etc....
thumbup.gif
mike60smart
Hi
I have updated the Form for you

Your structure was wrong as you had in the Purchase Table all of the fields for the Vendor.
This would be wrong as you already have these fields in the Vendor table.

All you need in the Purchase table was the field VendorID - then on the form you would have your ComboBox
which looks up the values from the vendor Table
When you select the Vendor the ID for that vendor is stored in the Puchase table in the VendorID field.

See the updated form

Regards

Mike
Edited by: mike60smart on Tue May 13 15:54:06 EDT 2008.
earthenfairie
Thanks so much...that did the trick...it's just been so long since I've programmed combo boxes. Thanks for the help!!
Larry Larsen
Hi
HAs Mike has indicted you have an issue with your structure..
(sadly I never looked..)
Thanks for the catch Mike..
thumbup.gif
earthenfairie
I'm still having a minor problem with the function of this combo box. I've tried several different small changes to no avail. Would you mind taking another look at it. It apparently needs one small tweak somewhere that I'm not seeing. Let know and thanks for the help, once again.
Larry Larsen
Hi Brandy
It would seem you have place your combo references directly into the the controls "Control Source" property and in effect made them unbound as before they were bound to the underlying table.
just need to understand what your trying to achieve with this form as we may need a different approach.
thumbup.gif
mike60smart
Hi Brandy
Is Larry has stated - what are you trying to record in the tbl Purchases??
How does this table relate to the Vendors table? Do you want to record a number of Purchases for a Vendor?
HAs I said in my previous post your table Vendors has all of the fields to record details of Purchases together
with ALL of the fields from the Vendors table ???
You DO NOT want to record ALL of the fields for the Vendor in this table as you already have these details stored in the Vendor table ie Vendor Address, City, State, Zip. Telephone, Contact Name , Account Number.
All you need to store in the Purchase Table is the VendorID and you select this Vendor ID by menas of a ComboBox
See the modified dbase
Mike
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.