opening a new form at a new record

simonI

Registered User.
Local time
Today, 07:06
Joined
Dec 22, 2005
Messages
25
looking for help again!!

i am trying to switch between 2 forms using a command button..

i have 2 things i am trying to achieve

i want the form to open up at a new record as at the moment it seems to be opening at the last record created.. i have tried to use an open form function for new records but that doesnt seem to work.

secondly i have tried to use the code below to go to the next record then close the form and open a new one...

DoCmd.GoToRecord , , acNewRec
DoCmd.Close
DoCmd.OpenForm ("Welcome Page")


but so far all it does is open the new form it doesnt go on to the new record in the current one!!!


hope it makes sense

cheers

si
 
forms

If you open a form and under the On Open event you have the code that uses the DoCmd.GoToRecord , , acNewRec then it will go to a new record. If you want to go to the last record use DoCmd.GoToRecord , , acLast.

If you close this form and open a new form it will go to the first record in the new form unless otherwise specified.

Don't know if this helps.
 
i am being a bit thick and am still a novice at this but when i tried to put the code in the on open box it told me that it couldnt find the macro. so i created a macro (below) and put the sub name in and it told me that i couldnt do it. i then tried the on open bit but that didnt work.. sorry can you spell it out a bit!!!!

Sub gotonextrec()
DoCmd.GoToRecord , , acNewRec


End Sub
 
Forms

Go to design view of the form. In the Upper left of the form right click and then click on Properties. Locate the On Open Event. Click on it and you see a small arrow to the right. Click on that and click on Event Procedures. Enter the following code in there.....DoCmd.GoToRecord , , acNewRec
Save the form and open it.
 
thank you i have done it now!!!

cheers again

Si
 

Users who are viewing this thread

Back
Top Bottom