Changing a form field's property based on an action

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form w/ a locked field. This form is used to view existing data but
also to add new data. If the user clicks the 'new' button, I would like the
'account' field's property to change from 'locked' to 'unlocked'. How can I
do this?
 
in the form's Current event procedure, add the following, as

Me!Account.Locked = Not Me.NewRecord

if "Account" is not the name of the control that you want to be
locked/unlocked, then substitute the correct control name.

hth
 
Tina,

thanks for the help. Your suggestion seems exactly what I want to do. But,
when I tried to used it, I received an error message. "The object doesn't
contain the Automation object 'Me." * Expression may not result in teh name
of a macro, the name of a user-defined function, or [Event Procedure]. There
may have been an error evalutation the function, event, or macro.

I don't know enough about access to deal w/ this.

The 'account' field is a combo box and the user gets to a new record thru a
new record button lableled 'add/ update'.

I would really appreciate any further assistance or suggestions,.
 
Sue said:
Tina,

thanks for the help. Your suggestion seems exactly what I want to do.
But, when I tried to used it, I received an error message. "The
object doesn't contain the Automation object 'Me." * Expression may
not result in teh name of a macro, the name of a user-defined
function, or [Event Procedure]. There may have been an error
evalutation the function, event, or macro.

I don't know enough about access to deal w/ this.

You wrote the VBA code directly into the event property box. What you need to
do is enter "[Event Procedure]" in the event property box and then press the
builder button [...] to take you to the VBA code editor window. THAT is where
the code goes.

The only things you can enter directly into an event property box is the name of
a macro or VBA function (hence the error message you received).
 
Back
Top