Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to fill text boxes according to selection from cbobox??

Status
Not open for further replies.

miscluce

MIS
Oct 4, 2007
149
US
if I have one table (customer) with 3 fields (custID)(fname)(lname)and 2 text boxes(txtfname)(txtlname) and one combobox(cbobox1).
I know I need to filter by the custID but how can I link this to populate my textboxes according to selection of the ID in the combo box. I also know how to populate the cbobox 1 with the ID. I just dont know how to link it to the textboxes with the proper code. I am thinking in the control source property?? does anybod have a snippet of this that can help me get an idea of how to set this up?

any help is apppreciated?
 
Say you have a form bound to your table.
simply follow the combo wizard (3rd option).

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
this will be unbound. I know its done in the after update event
 
You may use the Column property of the ComboBox object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
this is what I figured out but I get nothing in my txtboxes

Private Sub cboNames_AfterUpdate()
Me.txtNameID = Me.cboNames.Column(1)
Me.txtFirstName = Me.cboNames.Column(2)
Me.txtLastName = Me.cboNames.Column(3)
End Sub
 
What is the actual SQL code of the RowSource property of cboNames?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
RowSource property of cboNames? well, it is blank in the properties.

I am using this to populate it

Do Until rsNames.EOF
cboNames.AddItem rsNames!LastName
rsNames.MoveNext
Loop
 
Why loop through a recordset to load the combo box when you could simply get the data directly from a table or query?

Anyway, did you try dlookup?


Randy
 
I did try a query in the properties window under row source that didn't help either. I still got nothing.

That may not work anyway because I need to have this program unbound because I need to be able to let one user update a record while another user may or may not be viewing it.
If I can design some of the functionality using access's window this would be a whole lot easier but this is my first time using vba with access. Now I Am using a SQL as a back end database. I may be able to use access to code some of this stuff for me. I dont know? Do I have to unbound everything or just some stuff?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top