on load event

M

myxmaster

Hello, I have the following code in the load event of a form named new
player:

Private Sub Form_Load()
DoCmd.GoToRecord acForm, Me.Name, acNewRecord
End Sub

When ever I load the form I get an error message

runtime error 215
you cant go to the specific record.

I simply wish to open the form with empty fields. Any help sis most
appreciated.
Tia
 
A

Allen Browne

There are several things that could go wrong here, such as
a) you are already at a new record,
b) the form doesn't allow new records,
c) the form in a mode that doesn't respond to that code,
d) the form's source data is read-only (joins in query, inconsistent
dynaset, ...),
e) the form is unbound,
f) there is code in another event that prevents this from working,
g) there's a problem with user permissions,
h) other stuff neither you nor I thought of.

The following handles the first 3 of those cases anyway:
If Me.AllowAdditions And Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If

Include error handling to recover from the other cases.
 

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