recogising how form is openned

A

Andre C

is there a VBA way of telling if a form is opened in add or edit
mode. I want to make a particular control invisible if the form is
opened in add mode.
 
F

fredg

is there a VBA way of telling if a form is opened in add or edit
mode. I want to make a particular control invisible if the form is
opened in add mode.

If Me.AllowEdits = true Then

If Me.AllowAdditions = True Then

If Me.DataEntry = True then
 
K

Klatuu

That will tell you whether they are allowed, but it will not tell you the
datamode of the form.

If there is a property that returns that condition, I am not aware of it.
One solution would be to use the OpenArgs argument of the OpenForm method to
tell the form what mode it is being opened in. Then in the Load event of the
form, check the value of OpenArgs to determine whether to show or hide the
control.

Not elegant, but I can't find another way.
 
Top