Robert said:
Well, it all looks good as far as I can see. What does ValidateForm look
like?
Public Function ValidateForm(ByVal strCurrentForm As String, ByRef
boolYes As Boolean) As Boolean
Dim rst As New ADODB.Recordset
Dim myCntrl As Control
Dim myField As ADODB.Field
Dim sql As String
Dim strNotValid As String
'Dim boolOk As Boolean
Dim intCurrPatient As Integer 'PatientID currently being viewed.
intCurrPatient = rstRecordSet.Fields(strPatIDfield)
sql = "SELECT * FROM " & strValTableName
sql = sql & " WHERE Patient_ID = " & intCurrPatient
rst.Open sql, CurrentProject.Connection
boolYes = True
strNotValid = ""
For Each myCntrl In Forms(strCurrentForm).Controls
For Each myField In rst.Fields
If myCntrl.Name = myField.Name Then
If myCntrl <> myField Or IsNull(myCntrl) <> IsNull(myField)
Then
strNotValid = strNotValid & myCntrl.Name & " " & myCntrl
& " <> " & myField & vbCrLf
boolYes = False
End If
End If
Next myField
Next myCntrl
rst.Close
Set rst = Nothing
If Not boolYes Then
MsgBox strNotValid, vbCritical, "Errors Found!"
End If
'''''i took this out because i don't need it now.
'ValidateForm = boolYes
'Debug.Print ValidateForm
End Function ' ValidateForm()
What's rcRecordControlExt...a subform?
it's really kind of a wrapper for a control that all of the connected
forms use. by that i mean this app contains an electronic version of a
group of related paper forms. one paper form may have a hundred or
more questions so the questions are divided among several forms. each
form has navigation buttons that allow the user to move the next or
previous form. rcRecordControlExt is the instantiated version of this
control.