Custom Warnings

R

Ripper

I am using the following FANTASTIC code I received from Albert.

In the form's BeforeUpdate event cancel = MyVerify

Private Function MyVerify()

Dim colFields As New Collection

MyVerify = False
colFields.Add "StudentID,Student Name"
colFields.Add "Teacher,Teacher Name"
colFields.Add "Period,Period"
colFields.Add "ReasonID,Reason"
colFields.Add "Location,Location"
colFields.Add "Description,Description"

MyVerify = vFields(colFields)

End Function

Private Function vFields(colFields As Collection) As Boolean

Dim strErrorText As String
Dim strControl As String
Dim i As Integer

For i = 1 To colFields.Count
strControl = Split(colFields(i), ",")(0)
strErrorText = Split(colFields(i), ",")(1)
If IsNull(Me(strControl)) = True Then

MsgBox strErrorText & " is required", vbExclamation, AppName
Me(strControl).SetFocus
vFields = True
Exit Function
End If
Next i

End Function


My problem is when I have the users use the X to close and save the info on
the form, bypassing that ugly docmd.close bug. Access still prompts me if I
want to close the form and not save the record. I do not want that as an
option! How can I eliminate the yes / no save record warning and still use
the code to prompt the user with my custom messages?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top