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

TextBoxes update table whose record determined by Combo Box 1

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I need to update 2 fields in a Table ("TableName") using two textboxes (txtBox1, txtBox2) whose unique record is determined by ComboBox2.

ComboBox1 selects a query which populates ComboBox2.

Can anyone help me with this ???
 
You'll need to run an UPDATE query when the user presses a button after updating the information in txtBox2 that runs a query like:

UPDATE TableName SET field1 = Me.txtBox1, field2 = txtBox2 WHERE RecordID = me.ComboBox2



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Thanks lespaul - I appreciate your help. Do you know where I can find some VBA Access code ???
 
You can browse Forum705 Access Modules (VBA Coding), I'm more of a query person not Access specific. I don't do any work in Access so I don't know where else to refer you for resources.

Leslie
 
One VBA way:
Code:
DoCmd.RunSQL "UPDATE TableName SET field1='" & Me!txtBox1 & "',field2='" & Me!txtBox2 & "' WHERE RecordID='" & Me!ComboBox2 & "'"

for each field defined as numeric, get rid of the corresponding single quotes.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top