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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Dropdown to update another table

Status
Not open for further replies.

ElmoFringby30

Programmer
May 24, 2001
10
0
0
US
I am trying to use a Dropdown (combobox) on a form to add data from one table to another (by clicking on an entry in the combo box). Any help out there?I am desperate.
 
Have you considered grabbing the table's data with a recordset object? I myself am new to Access with the project of building a multiple-user application for where I work. I've been creating all my forms with all unbounded text boxes, and I don't quite know if this is the best way to go or not, but atleast this way I do have complete control to handle data from any number of tables any way I want.
 
Hi!

You can create SQL clause or Append query based on your combobox for it. I use DoCmd.RunSQL in my applications always because SQL-s (queries) run better if criterias are defined as values.

dim strSQL as string

strSQL = "INSERT INTO Table1( Field1, Field2, Field3) "
strSQL = strSQL & "SELECT Table2.Field3, Table2.Field4, Table2.Field5 "
strSQL = strSQL & "FROM ADR "
strSQL = strSQL & "WHERE ADR.Street=" & MyCriteria & ";"

DoCmd.SetWarnings False 'Hide confirm message
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True


Also you can create Append query based on combobox and open it with VBA code

DoCmd.SetWarnings False 'Hide confirm message
DoCmd.OpenQuery "MyAppendQuery"
DoCmd.SetWarnings True


Aivars





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top