Why "DataEntry isn't available?"

G

Guest

I have a Command button called "AddNew" on a form which allows a user to add
a new record. I used: DoCmd.RunCommand acCmdDataEntry in the AddNew
Subfunction. However, everytime when I click "AddNew" button. A error message
pops up saying: Run time error "2046". The command or action 'DataEntry'
isn't available.

Does anyone know why this happened? I checked the form property settings, I
have AllowEdits: Yes; AllowDeletions: Yes; AllowAdditions: Yes; DataEntry:
No. Even though I change DataEntry setting to "Yes", I still got the same
error message. Would someone please let me know why? What did I wrong?

THanks in advance?

Ally
 
J

John Vinson

I have a Command button called "AddNew" on a form which allows a user to add
a new record. I used: DoCmd.RunCommand acCmdDataEntry in the AddNew
Subfunction. However, everytime when I click "AddNew" button. A error message
pops up saying: Run time error "2046". The command or action 'DataEntry'
isn't available.

Does anyone know why this happened? I checked the form property settings, I
have AllowEdits: Yes; AllowDeletions: Yes; AllowAdditions: Yes; DataEntry:
No. Even though I change DataEntry setting to "Yes", I still got the same
error message. Would someone please let me know why? What did I wrong?

Something in your code... which we cannot see.

Please post the code in the Click event.


John W. Vinson[MVP]
 
G

Guest

John,

Thanks for the response. I have my code as below in the Click funciton:

Private Sub cmdAddNew_Click()
' If changes on this row, then save first
If Me.Dirty Then
If IsNothing(Me![SIPID]) Then
MsgBox "Must save current record with a valid SIPID# before
adding another.", vbCritical, "Microsoft Press"
Exit Sub
End If
DoCmd.RunCommand acCmdSaveRecord
End If
' Execute a Data Entry command
DoCmd.RunCommand acCmdDataEntry
Me![SIPID].SetFocus
Me!cmdAddNew.Visible = False
Me!cmdShowAll.Visible = True
Me!cmdSearch.Enabled = False

End Sub

P.S: I used this code for some other AddNew button on other forms. It works
well. But I have no idea why it does not work this time.

I really appreciate your help!

Thanks,

Ally
 

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