Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / July 2007

Tip: Looking for answers? Try searching our database.

Allow Edits if Field isNull

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
richard - 23 Jul 2007 14:54 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.