I have a standard Module called DisplayTime
that contains
Basically this function opens a form frmGetTime
within the frmGetTime
I placed =GetTime([txtCheckIn]) on the On Click property of text
box "txtCheckIn" within form frmGetTime
When I click within "txtCheckIn" I get the following error
"Compile error: Variable not defined"
I can't figure out what variable the error is refering to..
Also will my function work?
It's suppose to pass the value of time to the text box
I attached the DB
that contains
Code:
Option Compare Database
Option Explicit
Public txtBox As TextBox
Public Function GetTime(txtBox As TextBox)
DoCmd.OpenForm frmGetTime
End Function
Basically this function opens a form frmGetTime
within the frmGetTime
Code:
Option Compare Database
Option Explicit
Dim intRawHour As Integer
Dim strRawMinutes As String 'Reason this is String and not Integer
because of 00 value
Dim strAMPM As String
Dim CompleteTime As Variant
Private Sub cmdOK_Click()
intRawHour = Forms!frmGetTime!cboHour
strRawMinutes = Forms!frmGetTime!cboMinutes
strAMPM = Forms!frmGetTime!cboAMPM
CompleteTime = TimeValue(intRawHour & ":" & strRawMinutes & strAMPM)
txtBox.Value = CompleteTime
Debug.Print CompleteTime
End Sub
I placed =GetTime([txtCheckIn]) on the On Click property of text
box "txtCheckIn" within form frmGetTime
When I click within "txtCheckIn" I get the following error
"Compile error: Variable not defined"
I can't figure out what variable the error is refering to..
Also will my function work?
It's suppose to pass the value of time to the text box
I attached the DB