PhilipEwen
Registered User.
- Local time
- Today, 16:01
- Joined
- Jun 11, 2001
- Messages
- 81
Hi, following on from my last post, I have partly solved the problem.....now i get 'invalid use of Null'
basically if a TreatmentID exists then it opens the form. If it doesn't exist then i want it to show an error message.
It works if a TreatmentID does exist, but comes up with 'invalid use of Null' if it doesn't. Where am i going wrong ??
Private Sub TreatmentDate_DblClick(Cancel As Integer)
On Error GoTo Err_TreatmentDate_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
Dim stID As String
stID = Me![TreatmentID]
If stID = "" Then
Dim strTitle As String
Dim strMessage As String
Dim lResponse As Long
strTitle = "No Treatment History"
strMessage = "There is no history for this Customer, please Add a History " & stID
lResponse = MsgBox(strMessage, vbInformation + vbOKOnly, strTitle)
Cancel = True
'Me.Undo
Exit Sub
Else
stDocName = "Customer_Treatment_Detailed"
stLinkCriteria = "[TreatmentID]=" & Me![TreatmentID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_TreatmentDate_DblClick_:
Exit Sub
Err_TreatmentDate_DblClick:
MsgBox Err.Description
Resume Exit_TreatmentDate_DblClick_
End Sub
THANKS !!
basically if a TreatmentID exists then it opens the form. If it doesn't exist then i want it to show an error message.
It works if a TreatmentID does exist, but comes up with 'invalid use of Null' if it doesn't. Where am i going wrong ??
Private Sub TreatmentDate_DblClick(Cancel As Integer)
On Error GoTo Err_TreatmentDate_DblClick
Dim stDocName As String
Dim stLinkCriteria As String
Dim stID As String
stID = Me![TreatmentID]
If stID = "" Then
Dim strTitle As String
Dim strMessage As String
Dim lResponse As Long
strTitle = "No Treatment History"
strMessage = "There is no history for this Customer, please Add a History " & stID
lResponse = MsgBox(strMessage, vbInformation + vbOKOnly, strTitle)
Cancel = True
'Me.Undo
Exit Sub
Else
stDocName = "Customer_Treatment_Detailed"
stLinkCriteria = "[TreatmentID]=" & Me![TreatmentID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_TreatmentDate_DblClick_:
Exit Sub
Err_TreatmentDate_DblClick:
MsgBox Err.Description
Resume Exit_TreatmentDate_DblClick_
End Sub
THANKS !!