Results 1 to 6 of 6
  1. #1
    lzuke is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2012
    Posts
    7

    How to make previous month data "read only"

    Newbie creating a simple database for entering program attendance statistics for a library system.

    At each EOM a report will run that shows all the attendance data for the month.


    Once the reports are run at EOM, we don't want any changes made to that data (no adds, no deletes, no edits).
    Can data from previous months be "read only" from the data entry form?

    The only thing I've come across so far is doing an append/delete, which I'm a little afraid of. I was hoping I could just put a control in the form.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    One way would be to set those form properties (Allow Edits, etc) in the current event of the form, testing the date of the record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lzuke is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2012
    Posts
    7
    Thanks very much Paul.
    What is the procedure for doing that? (I'm getting hung up on term "current event" of the form and "testing the date".)

    Also, I wonder if what I'm trying to do is not commonly done. I have been searching my books and the web for a while now without success, so I wonder how people normally protect (archive?) their data? (I realize I didn't say anything about archiving in my first post, but I suppose it is a form of archiving?)

    I want to keep the current month data very open to add/edits/deletes, but just want to lock off those previous months so that no matter when I run a report for a prior month/range of months, the data will remain the same as when it was reported on it's month close.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Replace YourDateField in the code below with the actual name of your Date Field in the Record:

    Code:
    Private Sub Form_Current()
     If Month(Date) & Year(Date) <> Month(Me.YourDateField) & Year(Me.YourDateField) Then
       Me.AllowAdditions = False
       Me.AllowEdits = False
       Me.AllowDeletions = False
     Else
       Me.AllowAdditions = True
       Me.AllowEdits = True
       Me.AllowDeletions = True
     End If
    End Sub


    And, yes, preventing changes to historic data is frequently done. The above is one way to do it, or you could base your Form on a Query and use the same Criteria to only display Records, to your users, for the current month. It all depends on your particular needs.

    Linq ;0)>

  5. #5
    lzuke is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2012
    Posts
    7
    Thanks again for your assistance, Paul! Where do you input the code?
    I know I'm totally exposing my novice-ness!
    - Lesa

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Generally here, but you want the current event of the form:

    http://www.baldyweb.com/FirstVBA.htm

    Make sure you understand what Linq's code is doing; it may not be exactly what you want.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  2. Replies: 4
    Last Post: 06-22-2012, 04:00 AM
  3. Replies: 5
    Last Post: 03-05-2012, 08:06 AM
  4. Replies: 0
    Last Post: 10-13-2009, 11:54 AM
  5. "Previous Month" button
    By allochthonous in forum Programming
    Replies: 3
    Last Post: 09-10-2006, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums