Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2013
    Vestal, NY

    Unanswered: How Do I set AllowEdits to False for a Query (not a form)?

    I'm sorry if this is on this forum somewhere, but I've searched the internet for days and haven't found the answer to this questions.

    I know how to set AllowEdits to False on an event for a form. BUT, when I go to Query, Design View in Access 2007, there is no place to enter an Event Procedure.

    Here is the code I successfully used for limiting user edits on a form, which I stole directly from this link: Access Security Blog | Login Security using Access VBA

    But, I want to use this same method and apply it somehow directly to certain queries in my database. Any ideas how to do that? I suspect it might involve using a Module, but I have never set up a Module so do not know where to begin.

    If Forms!frmLogin!cboUser.Column(4) = 4 Then
    Me.AllowEdits = False
    Me.AllowAdditions = False
    Me.AllowDeletes = False
    Me.AllowEdits = True
    Me.AllowAdditions = True
    Me.AllowDeletes = True
    End If

    Thanks in advance for the help!

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You can always add a column or a clause in the query (even a useless one) that will render it read only. see:Microsoft Access tips: Why is my query read-only?
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I was going to suggest that, and it would work if simply making it a Read-Only Query was the object, but the OP wants to do this conditionally, based on some value, the value of Forms!frmLogin!cboUser.Column(4), in this case.

    Only way to do that, I'd think, is to have a Form where that Value was determined before opening the Query, then having two Queries, one Read-Only and the other being editable. Then, based on the condition, opening the appropriate Query.

    The real question, here, is why insist on using the Query, as opposed to using a Form based on the Query as the user interface? Then the problem isn't a problem.

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    A query, table or view is the data source, it shoudl be independent of the user interface

    do your add/delte/changes bit in the user interface and control it within the user interface in a form

    but that also assume that you do not allow your users direct acess to queries, tables or for that matter datasheets
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts