Hi Stephen, I don't know about disabling the OK button, but you can catch users hitting the OK button and dump them back to the form using something like this:
Sub OnFormCancel
Dim bResult
bResult = Application.MessageBox ("Are you sure you want to cancel?", apYesNo, "Cancel?")
If bResult = apNo Then
ThisEvent.Result = False
End If
If bResult = apYes Then
ThisEvent.Result = True
End If
End Sub
This was in the onquerycancel events of all of my pages so that if a user hits cancel, they get asked if they really mean it. You could do the same thing with the onOK event, asking if they really mean to hit OK. For a reason that escapes me right now I think you have to do it on each page, rather then on the form level. Alternatively you could check variables on each of the pages using the onvalidate event, and by writing a Sub that checks the variables on each page, make sure that the user cannot exit until the required fields are entered and error checked, as seen below:
Sub ValidateUserPTwo
Dim objPg
Set objPg = ThisEvent.Object
If objPg.Controls("cboDP").value = "" Then
ThisEvent.Result = False
ThisEvent.MessageText = "You must select a Discharge Point Layer to Continue"
ThisEvent.MessageType = apOKOnly + apExclamation
Exit Sub
End If
ThisEvent.Result = True
End Sub
So for instance, this forces the user to select a Discharge Point Layer. If the value of that combo box isn't empty, it falls through and hits ThisEvent.Result = True, allowing the page to be validated.