Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    47

    Unanswered: Don't Allow Row Deletions

    What is the simplest way to block row deletions? It is ok if it can be overridden I am just trying to discourage deleting rows.

    I have been trying to work with User level security but is getting way to complicated for what I am trying to do.

    Thank you in advance!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    How about popping up a message confirming that the user actually wants to delete the record?

    Code:
    Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
        ' Suppress default Delete Confirm dialog box.
        Response = acDataErrContinue
        ' Display custom dialog box.
        If MsgBox("Delete this record?", vbOKCancel) = vbCancel Then
            Cancel = True
        End If
    End Sub
    BTW, that's straight from the horse's mouth (or at least from one end of the horse!) Micro$oft Help!

    Linq
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jan 2006
    Posts
    47

    Is there a way to do this on the table itself?

    How would this be done on the table itself? If this is not possible at least in the query?

    I am not using to many forms and allowing data updates via a straight query for simplicity.

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,418
    Provided Answers: 7
    Can't do on tables

    Not a Good look letting the user data enrty in the table

    Build a Form that look like a table then the above code will work
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    StePhan is exactly right! You should never allow end users access to your tables! User access to data should only be done thru forms. If you don't have the time/patience/skills to create your own forms from scratch, use the Forms Wizard. Under "Layout" choose Datasheet and the form will look identical to a table or query, but you'll be able to use the code above to do the job you're trying to do. Using forms gives you control over your data that is lacking when using just tables and queries.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

Posting Permissions

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