invalid use of null

anthonyevans

Registered User.
Local time
Today, 07:56
Joined
Mar 15, 2001
Messages
29
Dear All,

I am getting an 'invalid use of null' error on clicking the button with the following underlying code. What is the problem here ?


Private Sub accidentreport_Click()
On Error GoTo Err_accidentreport_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim c, d As Date
Dim a, b, f, g, h As String
Dim e As Date

a = Me![First_Name]
b = Me![Surname]
c = Me![Date_Of_Birth]
d = Me![Date_Of_Incident]
e = Me![Time_Of_Incident]
f = Me![Company_Or_Production_Name]
g = Me![Location_Of_The_Incident]
h = Me![Condition_Reason_For_Attendance]
stDocName = "Accident Report Form"

stLinkCriteria = "[Serial_Number]=" & Me![Serial_Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms![Accident Report Form]![First_Name] = a
Forms![Accident Report Form]![Surname] = b
Forms![Accident Report Form]![Date_Of_Birth] = c
Forms![Accident Report Form]![Date_Of_Incident] = d
Forms![Accident Report Form]![Time_Of_Incident] = e
Forms![Accident Report Form]![Company_Or_Production_Name] = f
Forms![Accident Report Form]![Location_Of_The_Incident] = g
Forms![Accident Report Form]![Condition_Reason_For_Attendance] = h
Forms![Accident Report Form].Refresh

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.Close acForm, "TREATMENT FORM"

stDocName = "Treatment Report"
DoCmd.OpenReport stDocName, acNormal, , "[Serial_Number] = [forms]![TREATMENT FORM]![Serial_Number]"

Exit_accidentreport_Click:
Exit Sub

Err_accidentreport_Click:
MsgBox Err.Description
Resume Exit_accidentreport_Click



Thankyou in advance for your help,


Anthony
 

Users who are viewing this thread

Back
Top Bottom