438 Error

K

Kirk P.

I've got a form that open in Edit mode. The CustID field is locked out
(Enabled = No and Locked = Yes) in order to prevent people from changing the
key field. When the user clicks Add they must manually specify a unique
key field, so the CustID must be enabled and unlocked. That is the purpose
of this code, but I'm getting a 438 object doesn't support this property or
method error. What am I doing wrong?

DoCmd.GoToRecord , , acNewRec
With Me!CustID
.Enabled = True
.Locked = False
.TabStop = True
.SetFocus = True
End With
 
K

Kirk P.

That worked - thanks. Can I associate this code with the Access supplied Add
navigation button? I know I can create buttons to duplicate the Navigation
buttons, but I really don't want to do that - I only need to interact with
the Add button.
 
K

Klatuu

Move the code to the form's Current event and check to see if it is a new
record:
If Me.NewRecord Then
With Me!CustID
.Enabled = True
.Locked = False
.TabStop = True
.SetFocus
End With
End If
 
Top