Access/Visual Basic Autosave

T

Tatakau

The database has two forms. [Form1] has a button that takes the user to
[Form2]. However, unless you click Save or close the [Form1] window first,
the changes made in [Form1] won't show up in [Form2].

I would like to write VB code to automatically save the changes made in
[Form1] when the button is clicked. Do you know the line of VB code required
to do this?

Nick
 
O

Ofer

You can use the wizard to do that for you by creating a button, and then
selecting the save option.
In any case, before you open the second form run this line of code

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
 
M

Murali

Hi,
I have a form which disaplys the data of the table in tabular view. That is
it shows me the list of all the records in that table. When i try to change
the data for 10 rows , and select UNDO command,only the last records gets
changed rest are committed to the new values. i don't want this, i need to be
able to edit 10 rows and cancel the changes at a time. can you please help me.

Thanks alot in advance.:)

Lynn Trapp said:
Try adding this to the beginning of the code behind your button that opens
Form2:

Form1.Refresh

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Tatakau said:
The database has two forms. [Form1] has a button that takes the user to
[Form2]. However, unless you click Save or close the [Form1] window
first,
the changes made in [Form1] won't show up in [Form2].

I would like to write VB code to automatically save the changes made in
[Form1] when the button is clicked. Do you know the line of VB code
required
to do this?

Nick
 
D

Douglas J. Steele

Sorry, Access doesn't work that way. As soon as focus moves from a row
that's been changed, the changes are saved.

One option would be to write your data to a temporary table before editting,
doing the editting on the temporary table and then writing the changes to
the permanent table once you're done. If you do go that route, put your
temporary table into a temporary database to avoid bloating your
application. Tony Toews has a sample of this at
http://www.granite.ab.ca/access/temptables.htm

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Murali said:
Hi,
I have a form which disaplys the data of the table in tabular view. That
is
it shows me the list of all the records in that table. When i try to
change
the data for 10 rows , and select UNDO command,only the last records gets
changed rest are committed to the new values. i don't want this, i need to
be
able to edit 10 rows and cancel the changes at a time. can you please help
me.

Thanks alot in advance.:)

Lynn Trapp said:
Try adding this to the beginning of the code behind your button that
opens
Form2:

Form1.Refresh

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Tatakau said:
The database has two forms. [Form1] has a button that takes the user
to
[Form2]. However, unless you click Save or close the [Form1] window
first,
the changes made in [Form1] won't show up in [Form2].

I would like to write VB code to automatically save the changes made in
[Form1] when the button is clicked. Do you know the line of VB code
required
to do this?

Nick
 

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