form to create record and update other records

Joined
Oct 21, 2009
Messages
4
Reaction score
0
I've got a simple table with 3 relevant fields: ID (autonumber), ParentID, and PartType. I have a form that lets me create a new part. The form has a combo box for each PartType, and these combo boxes list out the respective available IDs that do not have a ParentID yet.

What I want to do is create a button that will populate the ParentID field of each of the selected available IDs with the newly created ID.

So, I click on the form to create part 23. cboBox1 shows me some available IDs of PartType:1, say I select Part ID: 22. I want the form to update the Parent ID field of Part 22 with "23".

Any help would be grand.

Thanks,
GT
 
Joined
Oct 21, 2009
Messages
4
Reaction score
0
Solved

I figured it out. Here's the code:
DoCmd.RunSQL "Update table SET table.field = forms!formname![formfield] WHERE table.field = forms!formname![formcombobox].Value"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top