Stop standard Access messages

paulcraigdainty

Registered User.
Local time
Today, 17:43
Joined
Sep 25, 2004
Messages
74
I want to stop standard Access messages prompting the user. For example When i run a delete query through a form the following is displayed: 'You are about to run a delete query that will modify data in your table'. My users don't understand what a table is and they don't need to. I want to disable this message so i can replace with my own prompt. Any help would be appreciated, thanks.
 
I think this is what you want,

DoCmd.SetWarnings False

Run your query code here....


and don't forget!!


DoCmd.SetWarnings True

Regards,
 
Thanks John that worked perfectly! :)
 
Just to expand on this. If you find that you are running a number of delete/append/update queries and want a slicker method then it may be an idea to create a function - this way you'll only have one piece of code that would need updated should you decide to edit anything.

i.e

Code:
Public Function ActionQuery(ByVal QueryName As String) As Boolean
    On Error Goto Err_ActionQuery
    With DoCmd
        .SetWarnings False
        .OpenQuery QueryName
        .SetWarnings True
    End With
    ActionQuery = True
    Exit Function
Err_ActionQuery:
    ActionQuery = False
End Function

Now, from your code you can call this by passing the name of the query you wish to run to it and have the added bonus of knowing whether the query was successful or not.

i.e.

Code:
If ActionQuery("MyQuery") = True Then
    MsgBox "Action was successful.", vbInformation
Else
    MsgBox "Unable to action query.", vbExclamation
End If
 

Users who are viewing this thread

Back
Top Bottom