Is there an easy way to accomplish the following?
I have a form that has two dates in unbound controls (txtStartDate and txtEndDate). When it loads the default values are the oldest and newest records in txtStartDate and txtEndDate respectively. In the default properties of the controls I use:
“=Min([tblMyTable]![I_datInvoiceDate])” and “=Max([tblMyTable]![I_datInvoiceDate]) ” for the default values. It works exactly as planned when the form opens. However, I have added a “Reset” control on the form with the goal of being able to reset all the variables to their original default at the click of a button, as opposed to closing the form and reopening it. That was easy for the all the controls that had Null (for combo boxes) and False (for check boxes). The challenge, at least for me, is how to reset the values in the start and end date controls to the min and max date. The following is the code I have for the “On Click” event of the reset button:
‘********Start Code ****************
Private Sub cmdResetfrm_Rprts_Click()
Me.cboCompany.Value = Null
Me.cboLocation.Value = Null
Me.MinimumCount.Value = 0
Me.MinimumDollars.Value = 0
Me.chkIgnoreBlanks.Value = 0
Me.cboInvoiceNumber.Value = Null
Me.txtYear.Value = Year(Now())
Me.Cbo_ExpenseType.Requery
‘Me.txtStartDate.Requery ‘- No workie
‘Me.txttEndDate.Requery ‘- No workie
Me.Requery
End Sub
‘******** End Code ****************
Any ideas on how to reset the date controls to the min and max dates from the table? Thanks in advance for your ideas.
Respectfully,
Ken