I'm just starting to learn vba for access 2002 (xp), but i really need to know how to do something right away.
I need to know how to create a new record in one form with the data from another form. In other words, users fill out one form, and then hit a button which opens a 2nd form (based on a different table) and creates a new record with the data from the 1st form.
I have 2 forms (for the purpose of this discussion):
My employees fill out the information on the frmPreOrders form, which contains info like "last name", "first name", "address", etc.
There is a command button at the bottom of the frmPreOrders form called cmdPostToCustomersForm
I need the vba code that will cause the following to happen (as an event handler for the button's OnClick property)
1) User clicks the button after filling out the preorder form.
2) This causes the Customers form to open in add mode with a new record
3) The corresponding fields on the Customers form need to be updated with the info from the PreOrders form. In other words, the LastName field in Customers now needs to be updated to the LastName value from the PreOrders form, and so on. There are about a dozen field values that need transferred from the 1st form to the 2nd.
I know about storing redundant data and all that, and all I can say is that this is a very unique situation and I need this to happen.
I just need the text to paste in for the Private Sub ... End Sub or the Private Function...End Function, whichever kind it takes.
Can anyone help me with this? I wouldn't ask except that I'm sure it's stupid simple - I just haven't gotten far enough along in the book yet, and I'm up against a deadline!!!
I would thing that to those that can write vba procedures for Access that my question would be a simple one. Simply opening a second form with a button and adding a new record containing info from the 1st form should be simple enough.
In a couple of weeks' time, I expect to be able to write this myself, but I have to have this in place this week.
Can anyone help me? I hope to be able to return the favor someday, but I'm surprised noone has offered up a solution.
Thnks again in advance if you are able to help me with this...