Hi
I have a form based upon a table [Sample Details] upon which I display
various fields. On the form, if the field [CertNo] has a value in, I want the
form to be AllowEdits=False, but this may change as the user changes the
record viewed in the form
I have put the following code in the 'On Current'event of the form but does
not appear to be working.
I am relatively new to code so code could be the problem as well as the event.
Any help greatfully received
Code
Private Sub Form_Current()
If CertNo = NotNull Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub
Dirk Goldgar - 23 Jul 2007 15:07 GMT
> Hi
>
[quoted text clipped - 16 lines]
> End If
> End Sub
If IsNull(Me!CertNo) Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
**or**
Me.AllowEdits = IsNull(Me!CertNo)

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Andy Hull - 23 Jul 2007 15:08 GMT
Hi Richard
Try the following...
Private Sub Form_Current()
If IsNull(Me.CertNo) Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
End Sub
(Note: I added Me. to beginning of CertNo, removed Not from If and changed
order of True and False.)
Hope this helps
Andy Hull
> Hi
>
[quoted text clipped - 16 lines]
> End If
> End Sub
Carl Rapson - 23 Jul 2007 15:14 GMT
> Hi
>
[quoted text clipped - 19 lines]
> End If
> End Sub
I don't think 'NotNull' is valid. Try this instead:
Me.AllowEdits = IsNull(CertNo)
Carl Rapson