"The Roys" <trevr62 (AT) hotmail (DOT) com> wrote
Quote:
Hi
I have a combobox on a form (This form fills a table called Contacts)
which
gets its info (a list of suburbs) from a table called PostCodes. This
table
has Suburb, State, PostCode as its fields.
I want to fill the State textbox and the PostCode textbox on my form
automatically from the PostCodes table.
How ???? |
One possible solution is to include the Suburb, Postcode, State in the
recordset behind the combox. Set the column widths to appear in your
combobox to zero for the extra fields. Then, on the AfterUpdate event of the
combobox (ie. when a change is made) run some code that sets the values of
the State/Postcode fields to that of the other columns of the combobox.
eg.
Fields in rowsource of combobox might be:
Suburb, State, Postcode
Column widths 4;0;0. Bound column is 1. Number of columns is 3
Now on the AfterUpdate event for the combobox...
Private Sub cboSuburb_AfterUpdate()
'Note: when referencing columns in a combobox the count starts at ZERO
Me![txtState] = Me![cboSuburb].Column(1)
Me![txtPostcode] = Me![cboSuburb].Column(2)
End Sub
Hope that gives you a start.
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/reponse