HillTJ
To train a dog, first know more than the dog..
- Local time
- Today, 07:52
- Joined
- Apr 1, 2019
- Messages
- 731
Hi, another newby question. I have the following routine on the onchange event of a combobox on a subform called 'FRM_Inspect_Record subform' which is on the main form called 'FRM_Equipment'.
It works fine, although i do notice upon inspection that [Anniversary_Date] is the control source rather than the control name which is 'Text33'. As a secondary question, is this correct logic?
Anyway, back to my main problem. I have now copied 'FRM_Equipment' to a tabbed navigation form and get error 2450 'Calibration cannot find the referenced form 'FRM_Equipment'.'
Clearly my referencing is now incorrect but I'm confused.
Please help. Appreciate it Thanks.
It works fine, although i do notice upon inspection that [Anniversary_Date] is the control source rather than the control name which is 'Text33'. As a secondary question, is this correct logic?
Anyway, back to my main problem. I have now copied 'FRM_Equipment' to a tabbed navigation form and get error 2450 'Calibration cannot find the referenced form 'FRM_Equipment'.'
Clearly my referencing is now incorrect but I'm confused.
Please help. Appreciate it Thanks.
Code:
Private Sub Calibration_Frequency_AfterUpdate()
Dim ID As Long
Dim Temp_Date As Date
Dim Temp_Unit As Integer
Dim Temp_Frequency As Integer
On Error GoTo ErrorHandler
ID = Nz(DMax("InspectID", "Qry_Inspect_Equipment"), 0)
If ID = 0 Then
Me.[Anniversary_Date] = Date
Exit Sub
End If
Temp_Date = DLookup("[Anniversary_Date]", "TBL_Inspect_Record", "InspectID=" & ID)
Temp_Unit = DLookup("[Calibration_Unit]", "TBL_Inspect_Record", "InspectID=" & ID)
Temp_Frequency = DLookup("[Calibration_Frequency]", "TBL_Inspect_Record", "InspectID=" & ID)
Select Case Temp_Frequency
Case 1 ' Annually
Me.[Anniversary_Date] = DateAdd("yyyy", [Temp_Unit], [Temp_Date])
Case 2 'Monthly
Me.[Anniversary_Date] = DateAdd("m", [Calibration_Unit], [Temp_Date])
Case 3 'Weekly (Weekdays)
Me.[Anniversary_Date] = DateAdd("ww", [Calibration_Unit], [Temp_Date])
Case 4 ' Daily
Me.[Anniversary_Date] = DateAdd("d", [Calibration_Unit], [Temp_Date])
Case Else
End Select
ExitError:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 9999
Resume Next
Case 999
Resume Next
Case Else
Call LogError(Err.Number, Err.Description, "Calibration_Frequency_AfterUpdate()")
Resume ExitError
End Select
End Sub