Question : docmd.closeform

I have a button on my form (created by the wizard) which closes the form.  In the close event of the form the user has the option to cancel the close.  How do I stop access displaying a message advising the user that the docmd action had been cancelled ?  I have tried docmd.setwarnings false but this does not work !!

Answer : docmd.closeform

Try inserting the following code:

sub MyCloseButton_Click()

dim answer as integer

'The vbYesNo doesn't apply to Access 2.0 search help
'on msgbox...
answer = msgbox = "Do you want to exit?",vbYesNo (*)
if answer = vbYes then
    Docmd close
endif

exit sub

Hope it helps,

Jeroen W



Random Solutions  
 
programming4us programming4us