A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find out what Form DataMode is?



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2008, 02:15 PM posted to microsoft.public.access.forms
jutlaux
external usenet poster
 
Posts: 36
Default Find out what Form DataMode is?

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?
  #2  
Old April 22nd, 2008, 02:40 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Find out what Form DataMode is?

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
--
Dave Hargis, Microsoft Access MVP


"jutlaux" wrote:

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?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.