Another question to people smarter than me! LOL
I have a form with a variable - Dim cboOriginator as TextBox - that holds the info about a textbox i click on. when i click on it, i have a calendar set up to "become visible" and show either the date in the field i just clicked on or todays date if null. all of this worked fine when i had the date fields in the same table as the rest of the data; but now i have this info in a separate table and have it shown in a subform.
my problem is now that i have this subform to view these dates, i can no longer reference the variable on the main form to set it. how can i set the variable on the main for, when i click on the date textbox on the subform? my code is below.
Code for mousedown event on the date textbox
Code for onclick event on main form (KitView)
I have a form with a variable - Dim cboOriginator as TextBox - that holds the info about a textbox i click on. when i click on it, i have a calendar set up to "become visible" and show either the date in the field i just clicked on or todays date if null. all of this worked fine when i had the date fields in the same table as the rest of the data; but now i have this info in a separate table and have it shown in a subform.
my problem is now that i have this subform to view these dates, i can no longer reference the variable on the main form to set it. how can i set the variable on the main for, when i click on the date textbox on the subform? my code is below.
Code for mousedown event on the date textbox
Code:
Private Sub ActionDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Set ActionDate textbox to variable Set cboOriginator = ActionDate 'Show calendar Forms![KitView]!Calendar.Visible = True "set focus on calendar Forms![KitView]!Calendar.SetFocus 'If textbox had a date in it, set calendar to that date, else set to todays date If Not IsNull(cboOriginator) Then Forms![KitView]!Calendar.Value = ActionDate.Value Else Forms![KitView]!Calendar.Value = Date End If End Sub
Code:
Private Sub Calendar_Click() 'Set current calendar date value to variable cboOriginator.Value = Calendar.Value 'Set focus back to original textbox cboOriginator.SetFocus 'Hide calendar Calendar.Visible = False 'Clear variable Set cboOriginator = Nothing End Sub
Comment