Locking up Form for Editing

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

Guest

I want to users to update data in the table via form. Once the deadline for
updates passes I would like to "freeze" the form temporarily so no more
updates will be made. Once new data is available for next month, I need to
"unfreeze" the form so users can enter their updates again. How do I
accomplish this?
 
Somehow you need to tell Access the criteria for freezing the form. This
could be a day of the month, say the 15th, after which you will freeze until
the 1st of the next month, or you could set a table value each month to
indicate Frozen or Unfrozen, and use the DLookup() function to determine the
current state. There are many other possibilities.

To activate the freeze, but to permit browsing, set the form's AllowEdits,
AllowDeletions and AllowAdditions properties to False in the form's OnOpen
event procedure:

Dim blnFreeze as Boolean

' Code for determining freeze state by current date
' If the day of the month is greater or equal to 15, blnFreeze is True
blnFreeze = (DatePart("d", Now()) >= 15)

' Alternative code for determining freeze state by a single record in a
' table called Freeze with a single Yes/No field named FreezeState
blnFreeze = DLookup("[FreezeState]", "Freeze")

If blnFreeze Then
With Me
.AllowEdits = False
.AllowAdditions = False
.AllowDeletions = False
End With
Else
With Me
.AllowEdits = True
.AllowAdditions = True
.AllowDeletions = True
End With
End If

Hope that helps.
Sprinks
 
Back
Top