Disable the edit property of a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Adolph
    New Member
    • Oct 2012
    • 1

    #1

    Disable the edit property of a query

    I have a simple query that I run to allow a user to do datamining. This simple query will allow the user to change the data. I don't want to allow this. Is there a way to disable edits in a simple select query.
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    In short not from the query.
    If you have V2010 there are table level macros

    What I would do is the following.
    Build a form based on the query and lock down the form.

    Now that doesn't prevent the user from opening the query...

    So what I do is develop my form based on the query and then copy the SQL behind the query and go directly to the form's properties and paste that into the record sorce then delete the orignal query. I do this quite often... most of my production databases do not have any of the queries available directly to the user, they are all coded into the forms and only added to the querydef collection for certian types of reports, exports, and connection that require resolved objects.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      I think they mean edit the data resulting from the query. To disable editing the data, in the form properties, set the allow edits option to false.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        For the query itself, set the Recordset Type property to Snapshot.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Thank you NeoPa,
          I forget about that option in the properties page.
          I found that many of my users know how to change that too... problem when you work with a bunch of Chemists - too curious for our own good! :)

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Indeed. That's exactly my understanding of Chemists. They clearly have the right way of thinking for programming and logic. That probably explains why so many of our regular contributors come from that discipline.

            Comment

            • TheSmileyCoder
              Recognized Expert Moderator Top Contributor
              • Dec 2009
              • 2322

              #7
              I would say the best approach would be to setup a form that controls the query, and have the forms AllowEdits set to false.

              In short, think of it this way:
              Query and tables are for the developer
              Forms are really the way Access intends for users to interact with data, and its your job as developer to create the right forms.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32669

                #8
                I agree that's the correct way to approach matters generally, and is well worth bearing in mind. That doesn't necessarily mean it's wrong to disable editing on a query, but the design of the query needn't encapsulate everything required for the form, as the form is the main means of the user interfacing with the data.

                Comment

                Working...