Saving Records

Tyler08

Registered User.
Local time
Today, 07:31
Joined
Feb 27, 2008
Messages
44
Good Afternoon

I think this belongs in the Query Forum.

My database displays a form on which I enter details and create a new record. There is a button which when clicked runs a query and opens another form which displays the information entered on the first form.

The system works but in order to display the information on the second form I have to enter the information on the first form, close it then open it again to rerun the query prior to clicking the button to display the information on the second form.

Is there a command I can put in the first form On Close Event or the Button Click Event to rerun the query prior to the second form opening?

Thanks

Tyler
 
Hello Tyler!

There are two options;
1) Replace command button on Form Footer, or
2) put this code in front of "Open" next form, (Button click event).
DOcmd.RunCommand acCmdSaveRecord
 
Last edited:
Cheers MStef

I put a save record comand (DoCmd.RunCommand acCmdSaveRecord) in the On Open Event and it works when there is a newly entered record to save but crashes when there is not. Is this because the record has already been saved?

Can I code the open form event to check if there is an unsaved record?

Tyler
 
Try this code:

On Error Resume next
DoCmd.RunCommand acCmdSaveRecord
your code....
 
Cheers MStef

I put a save record comand (DoCmd.RunCommand acCmdSaveRecord) in the On Open Event and it works when there is a newly entered record to save but crashes when there is not. Is this because the record has already been saved?

Can I code the open form event to check if there is an unsaved record?

Tyler
He didn't say to put it in the On Open event - he said to put it in the click event BEFORE the code to open the other form.
 
Code moved to the top of the click event of the button which opens the second form.

Database functioning properly now.

Thanks for everyone's input.

Tyler
 

Users who are viewing this thread

Back
Top Bottom