Find out what Form DataMode is?

J

jutlaux

I have a form that has an "On Open" event and the problem with the event is
that when the form is opened with DataMode=acFormEdit I get a run-time error
'2448': "You can't assign a value to this object". The "On Open" Event
works fine with DataMode=acFormAdd.

I am wondering if there is a way to check the DataMode when an form is
opened so that I can separate out the code that is giving me the problems to
only run when DataMode=acFormAdd?
 
K

Klatuu

You can check the value of the DataEntry property.
If you open a form with acFormEdit, it will be False
If you open a form with acFormAdd, it will be True

So
If Me.DataEntry = True Then
'Do stuff form acFormAdd
Else
'Do stuff for acFormEdit
End If
 

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