I do not know what I am doing wrong. My lack of knowledge in macros and expressions is not helping any. Below is what I have entered to set this up:
Before insert (macro):
Action: GoToControl; control name: job#
Action: SetValue; Item: [Forms]![Submittal Requirements]![Job#].[Enabled]; Expression: No
Action: GoToControl; control name: job#
Action: SetValue; Item: [Forms]![Submittal Requirements]![Job#].[Locked]; Expression: Yes
After insert (macro):
Action: GoToControl; control name: job#
Action: SetValue; Item: [Forms]![Submittal Requirements]![Job#].[Enabled]; Expression: Yes
Action: GoToControl; control name: job#
Action: SetValue; Item: [Forms]![Submittal Requirements]![Vender#].[Locked]; Express: No
With it setup like this I am still able to change the job# field after the record has been created and when I create a new record and I try to enter information in the job# field I get the error message "you can't disable a control while it has focus". Can you see what I am doing wrong?
----- Steve Schapel wrote: -----
Shelly,
The meaning of this error message is that the control we are talking
about has the focus at the time the macro is trying to change its
Enabled property. The easiest way around this is to put a GoToControl
action in the macro before the existing actions, to shift the focus to
any other control on the form.
--
Steve Schapel, Microsoft Access MVP
I went ahead and used the full control reference in the Macro. When
I try and overwrite the data in the field I am trying to lock it
allows it. When I go to create a new record and I enter data in the
same field I get the error message "You can't disable a control while
it has the focus".