Full Version: Customizing Warning Messages On Docmd In Vba
UtterAccess Forums > Microsoft® Access > Access Forms
toons
Ok, I managed to get a function working properly and I initially suppressed the warning messages in VBA when I run a query. Is there a way to customize the warning messages instead of suppressing them, so when the query runs it says something like "Are you sure you want to add this contact?", allowing a yes/no answer and if I clik no I dont get that whole end/debug message. My current VBA code is this
With DoCmd
.SetWarnings False
.OpenQuery "qry_append_xmit_distr"
.SetWarnings True
End With
Thanks for your help!
JonSmith
CODE
Dim StrAnswer as string
trAnswer = Msgbox("Are you sure you want to do this?", vbinformation + vbyesno)
If stranswer = vbno then exit sub
With DoCmd
     .SetWarnings False
     .OpenQuery "qry_append_xmit_distr"
     .SetWarnings True
End With

Pop in that msgbox where you want and exit or skip code as appropriate.
toons
you are awesome!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.