dbTalk Databases Forums  

auto fill a textbox

comp.database.ms-access comp.database.ms-access


Discuss auto fill a textbox in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Roys
 
Posts: n/a

Default auto fill a textbox - 08-31-2003 , 06:46 AM






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 ????




Reply With Quote
  #2  
Old   
Bradley
 
Posts: n/a

Default Re: auto fill a textbox - 09-01-2003 , 10:52 PM






"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








Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.