anthonyevans
Registered User.
- Local time
- Today, 08:05
- Joined
- Mar 15, 2001
- Messages
- 29
Dear All, where in the following code and what is the actual code for closing the form that this code resides in. The form to close is TREATMENT FORM. Your help would be most appreciated.
I know the code isn't the most effiecient way of doing this but for now all i want is my question above resolved !!
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
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
End Sub
all the best,
Anthony
I know the code isn't the most effiecient way of doing this but for now all i want is my question above resolved !!
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
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
End Sub
all the best,
Anthony