Making a database temporarily read only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JulesII
    New Member
    • Jan 2008
    • 3

    Making a database temporarily read only

    Hi,
    I have a database which is able to show projects which are current and those which are archived. The users need to be able to search the archived data but are not allowed to edit it in anyway. I can use allowedits etc to make the forms read-only but this also affects the two combo boxes that are used to search for the projects by name and project id. I need to find a way to temporarily make the database read only whilst retaining the functionality of the controls on the forms. I am not able to close and re-open the database as other users will be using it to view current projects whilst others will be viewing archived. Splitting the database into two is not viable as some projects whilst archived are linked to other projects which are not and rely on common data files.
    Any suggestions would be really welcome
    Thanks
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by JulesII
    Hi,
    I have a database which is able to show projects which are current and those which are archived. The users need to be able to search the archived data but are not allowed to edit it in anyway. I can use allowedits etc to make the forms read-only but this also affects the two combo boxes that are used to search for the projects by name and project id. I need to find a way to temporarily make the database read only whilst retaining the functionality of the controls on the forms. I am not able to close and re-open the database as other users will be using it to view current projects whilst others will be viewing archived. Splitting the database into two is not viable as some projects whilst archived are linked to other projects which are not and rely on common data files.
    Any suggestions would be really welcome
    Thanks
    Hi Jules,

    Do you have field that determines if a record is archived lets say a tick box or a date field or some other indicator that flags the record as an archived record? if so then 'one' way would be for you to explore the 'conditional formatting' side of access for screen controls and base formatting logic on your archive field value to enable or disable controls accordingly. (Form design...menuba r...conditional formatting)

    Jim :)

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      I've read your post several times and I'm still having a hard time understanding exactly what you're doing, but it sounds, from some of your comments, as if you have separate form(s) for viewing the archived data. What you need to do, rather than make an entire form read-only, is to only lock the group of controls that you don't want edited.

      The way you "group" controls for this kind of manipulation is to use the little known Tag Property. Select the control(s) then got to Properties - Other and enter a value in the Tag Property. Don't get confused if you see a SmartTag Property! This is something else entirely!

      For the purposes of this demo, we'll make the Tag Property

      Marked

      Enter this in the Tag Property box (without quotation marks.)

      Also, for purposes of this demo, we'll change the Locked Property of the tagged controls to Locked = False. You can, of course, use the code to set any property that the particular control type has.

      Then, use this code.
      [CODE=vb]
      Private Sub Form_Load()
      Dim ctrl As Control

      For Each ctrl In Me.Controls
      If ctrl.Tag = "marked" Then
      ctrl.Locked = False
      End If
      Next

      End Sub[/CODE]

      Be sure that the controls that are tagged actually have the property you're trying to change, or you'll get an error! For instance, tagging a label control and then trying to change the Locked property will error out, because labels don't have an Locked property.

      The really nice thing is that you can have multiple levels within a form, i.e. several different Tags being used to identify different groups of controls to be manipulated.

      If you were viewing active and archived records in the same form, you could use a variation of this to implement Jim's idea.

      Welcome to TheScripts!

      Linq ;0)>

      Comment

      • JulesII
        New Member
        • Jan 2008
        • 3

        #4
        Missinglinq,
        many thanks for your input and help here. I've inherited this project mid way through its development and making some changes are not going to be easy. The project sits on 18 different forms most with sub and sub/sub forms.

        Comment

        Working...