Data Combo populate

I'm not sure about how easy this is, but Is there a way to populate fields of a record by selecting the info from a data combo control? For example, say the data combo is filled with company names. By selecting one of those company names all information from the company table will automatically come up on the form so that the user will not have to type the information themselves. Can this be done and how? I would appreciate any help at all.
[453 byte] By [privateagentx] at [2007-11-15 15:32:51]
# 1 Re: Data Combo populate
Select name from the combobox and generate an SQL which will retrieve the record from the database and fill your correspondent text boxes.

for text field
sSQL = "select * from YourTable where YourField = '" & Combo1.Text & "'"

for numeric field
sSQL = "select * from YourTable where YourField = " & Val(Combo1.Text)

Iouri Boutchkine
iouri@hotsheet.com
Iouri at 2007-11-10 1:08:35 >
# 2 Re: Data Combo populate
Thank you very much for your help. I have another question. This company data is part of a bigger database that i need to update. I actually have four tables in the database. The main table is a Project Table which holds the primary key (project number) and other data about the project (jobsite info, billing info). The Project Contacts table holds the primary key project num (to relate it with the project table) and the contact ID. The next table is the Contact Table which holds the primary key Contact ID and all the information about the contacts (phone, mobile number, fax) and the company ID. The last table is the Company Table which holds the primary key company ID and all the company information about the contact (company address, phone, fax). Having filled in the company info from the data combo how do i update all the corresponding tables? By the way i'm using ADO controls and access 2000 as a back end. Thanks in advice for your help.
privateagentx at 2007-11-10 1:09:27 >
# 3 Re: Data Combo populate
After filling the data you can execute SQL to update other tables

SQL = "Insert into YourTable Values(Value1, Value1,...)"

rate it if it helped you

Iouri Boutchkine
iouri@hotsheet.com
Iouri at 2007-11-10 1:10:31 >