Startup Form on New Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to prevent users from accidently modifying the 1st record that a form
opens when they open the database. I already know how to force a certain
form to open first. I would like that form to open on a new record. Is
there anyway to do that?
 
Try opening the form like this:

docmd.OpenForm "frmYourform",acNormal,,,acFormAdd

This will open the form and directly go to a new record.

hth
 
Where do I put that script?

Maurice said:
Try opening the form like this:

docmd.OpenForm "frmYourform",acNormal,,,acFormAdd

This will open the form and directly go to a new record.

hth
 
Two options:

If I read your post carefully it looks like you are opening the database by
using a startform which automatically opens. Open this form in design mode.
Go to the properties of the form. choose the OnOpen event. click the button
with the three dots choose code, place the following code :

Private Sub Form_Open(Cancel As Integer)
docmd.RunCommand acCmdRecordsGoToNew
End Sub

If you want to open the form from another form then place the code behind
the button which the user clicks to open the form.

let me know if this makes it clear for you...
 
I found and updated OnOpen event, but when I open the form, it still opens in
record 1 of 27 instead of a new record 28. This form has three subforms in
it. But I can click the "new (blank) record" button at the bottom of the
page and that does work (opens in record 28 of 28).
 
Ok, place the code you've added to the on_open of the form here so we can
take a look at it. Which version are you using? Try to explain if you want to
do it from the startup of the database or by clicking a button to open the
designated form...
 
Maurice,

I don't know what I did yesterday, but it works great since I re-inputted it.

Thanks!
 
Thank you so much for your clear instructions, Maurice. I've been trying to
figure out how to do this for several months now - and following your code
worked PERFECTLY!! Thank you! Thank you! Thank you!!
 
Wow, glad to be of service :-)
--
Maurice Ausum


lmp said:
Thank you so much for your clear instructions, Maurice. I've been trying to
figure out how to do this for several months now - and following your code
worked PERFECTLY!! Thank you! Thank you! Thank you!!
 
Back
Top