Me again. I found the below file and it works great,however when you click on one of the date boxes with out choosing a departmentand employee you get the run time error. I would like to eliminate the run timeerror and have it replaced with a message box that says you must choose adepartment and employee.
This is the code that is giving the error
Code:
Function SendToInputBox(mynum)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim f As Form
Dim g As String
Dim MyDate As Date
Dim UName As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblInput",dbOpenDynaset)
Set f = Forms!frmCalendar
Code:
MyDate = Format(f("Date" & mynum),"mm/dd/yyyy")
UName = f.cboUser.Column(1)
g = Format(MyDate, "dddd mmmm d, yyyy")
rs.FindFirst "InputDate = #" & MyDate &"# AND UserID = " & glngUserID
DoCmd.OpenForm "frmInputBox"
With Forms!frmInputBox
If Not rs.NoMatch Then
!txtAttendanceReason = rs!AttendanceReason
!InputText =rs!InputText
End If
!InputDay = mynum
!InputDate = MyDate
!InputFor = g
!NameLabel1.Caption = UName:
!original_text =f.Controls("Text" & mynum)
!InputText =f.Controls("Text" & mynum)
!InputText.SetFocus
End With
SendKeys "{F2}^{HOME}", False
End Function
It is the line in red that is highlighted yellow when I get the error The belowis the file it self. I also must say it is very well done. Just has the aboveclitch.