Option Explicit statement

Romper

Registered User.
Local time
Today, 17:01
Joined
Oct 28, 2012
Messages
83
Hi all,
I recently added a code to my forms so that I will now receive a message telling me to confirm changes to the record. When I run Analyze Performance now though I get an idea warning for each form in the database suggesting that I use an Option Explicit statement at the beginning of the declaration section. What on earth is it and what should it look like?

Example FRM_CWealthFDC code

Private Sub Form_BeforeUpdate (Cancel As Integer)

'Provide the user with the option to save/undo
'changes made to the record in the form

If MsgBox("Changes have been made to this Record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub

How does this need to be changed, or is there a better code altogether? I copied this one off the net.

Please help.
 
Thanks mate, I'll have a look.
 
Cheers for the link. Gave me exactly what I was after and resolved the Performance Analyzer problems with my forms.

Thanks.:D
 

Users who are viewing this thread

Back
Top Bottom