more VBA help needed please...
I need to combine the above code with other code I have. This is the code. When I compile the db the first line is highlighted and the error message is "Compile Error - Expected End of Sub". Any ideas?
Private Sub Command398_Click()
Function Information_ValidateCaseNum()
On Error GoTo Information_ValidateCaseNum_Err
' Attached to the Information form.
' Attached to the BeforeUpdate event of the CaseNum field.
If (Eval("DLookUp(""[CaseID]"",""[Demo]"",""[CaseID] = Form.[CaseID] "") Is Not Null")) Then
' If the value of CaseNum not unique, display a message.
MsgBox "The CaseNum you entered already exists. Enter a unique Case.", vbInformation, "Duplicate CaseNum"
' Return to the CaseNum control.
DoCmd.CancelEvent
Else
On Error GoTo Err_Command398_Click
Me![C-STADATCU] = Forms![NewCasePage1]![c-stadatcux]
Me![REFSRC] = Forms![NewCasePage1]![REFSRC]
If IsNull(Me!SUBREF) Then
MsgBox "Please enter a valid date in Date Submitted", vbOKOnly, "Date Validation"
Me![SUBREFx].SetFocus
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Case has been saved", 0, "Case Status"
End If
Exit_Command398_Click:
Exit Function
Err_Command398_Click:
MsgBox Err.Description
Resume Exit_Command398_Click
End Function
End If
Information_ValidateCaseNum_Exit:
Exit Function
Information_ValidateCaseNum_Err:
MsgBox Error$
Resume Information_ValidateCaseNum_Exit
End Function
End Sub