Pre-filling a text box from another source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to have a text box automatically pre-fill with the information
from a table once I make a choice from a combo box.

Here is what I am trying to do:

I have a drop-down box from a different source (not the form source), once I
make a choice from the combo/drop-down box, I want the next text field to
automatically pre-fill with information from that same record.

Can this be done?

Thanks.
 
Did you try to search? This is a very common question. Here is the search
I used:
http://groups-beta.google.com/groups?q=microsoft.public.access+combo+data+column+text

Here are some previous posts from that search:




You can include the field you want in the the query that feeds the combo.
Then you can populate a text box by referencing that column in your combo:

Me.yourTextBox = Me.yourCombo.Column(2)


adjust the column number as neccessary


--
HTH
Dan Artuso, Access MVP








Maybe try using VBA code rather than a macro.


Private Sub Combo2_AfterUpdate()
Me.Text4 = Me.Combo2.Column(1)
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)












RE: Populating the EmpName:


<in the AfterUpdate event>
Me.EmpName = Me.EmpNum.Column(1)
'/Note: this assumes that you have set the EmpNum .columncount = 2 ...
columns are zero based, therefore the First column is Column(0), second is
Column(1) etc


RE: Updating your table
If your TimeEntyr form is based on your TimeCard table, then Access will
update it for you
 
Add another column onto the combo to show the value that you want to use to
fill the text box (i.e. tweak the row source so that it contains a query
with the value that you currently have, and also that additional value; and
also increase the column count to two; when you get it working you can
change the column widths property to 3;0 - or whatever - to hide the
additional value)

In the after update event of the combo you can then do something like...

me.textbox=me.combo.column(1)

(Note that the column property is zero based - so the 2nd column is column
number 1.)
 
Back
Top