By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,372 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,372 IT Pros & Developers. It's quick & easy.

Updating Form Data to Table on Event Procedure

P: n/a
nic
Hi

I have two forms form1 and form2. I am trying to get all the data
entered in form1 to be updated to the table on an event. ie. when I
click the button to load form2, I need the data from form1 to exist in
the table for relationship reasons. form2 works fine if the records
displayed in form1 already exist in the table, ie form1 was closed
then re-opened or moving between records will also write the data to
the table. But if I have created a new record in form1 and then load
form2, any data is lost when the form is close as form1 data hasn't
been written to the table.

I would like for the data to be coded into the procedure that opens
form2. Also I am passing OpenArgs to form2.

Any suggestions.
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
You can write VBA code to do that; the overall plan is to create a
string which is a SQL Insert query, then
DoCmd.RunSQL strSQLInsertQuery

However,
A much easier approach (sually) is to use a statement (this version is
from Access 2000):
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
This saves the current record. Just run the code before opening form2!

If you allow the user to open form2 only from a button on form1, then
this should work just fine, added to the button's click event.

Access will build that code if you turn on the Access Control Wizards,
create a button, and when the Wizard opens, specify Record Operations -
Save Record.

Bruce Pick
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++
To send mail, remove all < > and [ ] and the junk ~ between:
[brucepick1]
< a~t >
[comcast.net]

nic wrote:
Hi

I have two forms form1 and form2. I am trying to get all the data
entered in form1 to be updated to the table on an event. ie. when I
click the button to load form2, I need the data from form1 to exist in
the table for relationship reasons. form2 works fine if the records
displayed in form1 already exist in the table, ie form1 was closed
then re-opened or moving between records will also write the data to
the table. But if I have created a new record in form1 and then load
form2, any data is lost when the form is close as form1 data hasn't
been written to the table.

I would like for the data to be coded into the procedure that opens
form2. Also I am passing OpenArgs to form2.

Any suggestions.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.