Need Help,


I am using the following code on the Unload event to verify my recommended fields have been entered and if not allow the user the option to enter the data. This code compiles and works perfect in the full version of access. Both 32 and 64 bit, on windows 7 and xp. However, as soon as I open it in Runtime 2010 the code error at the line "Cancel = True". I have commented out the other lines and this is the only line that errors. Any help or suggestions would be appreciated.

Matt


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Dim Ctrl1 As Control 'Taken By


For Each Ctrl1 In Me.Controls
If Ctrl1.Tag = "1" And IsNull(Ctrl1) Then
varResponse = MsgBox("The ~ Taken By ~ field has not been completed." & vbCrLf & vbLf & "This is a recommended field. Do you want to close anyway?", vbYesNo + vbQuestion, "Company Name")
If varResponse <> vbNo Then
DoCmd.Close acDefault, "Communications", acSaveNo
Exit For
Else
Cancel = True
Ctrl1.SetFocus
Exit For
End If
End If
Next Ctrl1