Hi all,
I am having an issue trying to debug this function. I downloaded a database from Microsoft and I am trying to implement into another database I am creating. This DB works okay but it isn't showing the correct date on the "frmInputBox".
There is a varible named "mynum" that is in the event "OnLoad" on the frmCalendar. This varible is referenced in the Module "modCalendar" but I can't for the life of my first born figure out why this varible isn't showing the correct date for the box selected.
I've attached a copy of the DB here so you can open and see for your self.
I am very very new to VBA and modules and avoid them like the plague if I can but I really like this feature and would love to use it and learn why and how one of you genius' fixed it.
The OnLoad event:
The function:
Any help would be great!
Larry
I am having an issue trying to debug this function. I downloaded a database from Microsoft and I am trying to implement into another database I am creating. This DB works okay but it isn't showing the correct date on the "frmInputBox".
There is a varible named "mynum" that is in the event "OnLoad" on the frmCalendar. This varible is referenced in the Module "modCalendar" but I can't for the life of my first born figure out why this varible isn't showing the correct date for the box selected.
I've attached a copy of the DB here so you can open and see for your self.
I am very very new to VBA and modules and avoid them like the plague if I can but I really like this feature and would love to use it and learn why and how one of you genius' fixed it.
The OnLoad event:
Code:
Private Sub Form_Load()
Dim i As Integer, j As Integer
Dim mycontrol As Control
Dim strYear As String, nextYear As String
Dim f As Form
Dim mynum
Set f = Forms!frmCalendar
For i = 1 To 37
Forms!frmCalendar!("Text" & i).Visible = False
Forms!frmCalendar!("Day" & i).Visible = False
Next
'Set mycontrol = Me.Year
j = 1990
strYear = j
For i = 1 To 60
nextYear = j + i
strYear = strYear & ";" & nextYear
'Me.Year.AddItem j + i
Next i
Me.year.RowSource = strYear
Me!month = Format(Now, "m")
Me!year = Format(Now, "yyyy")
Call Cal([month], [year])
End Sub
The function:
Code:
Function SendToInputBox(mynum)
Dim f As Form
Dim g As String
Set f = Forms!frmCalendar
g = Format(f("Date" & mynum), "dddd mmmm d, yyyy")
DoCmd.OpenForm "frmInputBox"
With Forms!frmInputBox
!InputDay = mynum
!InputDate = f("Date" & mynum)
!InputFor = g
!original_text = f("Text" & mynum)
!InputText = f("Text" & mynum)
!InputText.SetFocus
End With
SendKeys "{F2}^{HOME}", False
End Function
Any help would be great!
Larry