Sub setdater() won't work

cccapps

New Member
Joined
Feb 7, 2008
Messages
1
Can anyone help me with this subroutine:
Sub setdater()
If IsDate(Me.DaterBox1) Then MyDate1 = Me.DaterBox1 Else MyDate1 = Now()
If IsDate(Me.DaterBox2) Then MyDate2 = Me.DaterBox2 Else MyDate2 = Now()
End Sub

It errors out on If IsDate(Me.DaterBox1) Then

I get the runtime error 2467 - this expression refers to an object that is closed or doesn't exist.

My database is large with several reports running off of the switchboard automatically on a timer. When I run the reports individually they run fine but when I use the timer on my switchboard it bombs at this subroutine.

All the routines use this and run fine individually:
Call setdater
If IsDate(Me.DaterBox2) And IsDate(Me.DaterBox1) Then
Gvarday1 = MyDate1
Gvarday2 = MyDate2
Else
Gvarday1 = DateAdd("d", -1, Format(MyDate1, "mm/dd/yy"))
Gvarday2 = Format(MyDate1, "mm/dd/yy")
End If

Thanks.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,191,388
Messages
5,986,320
Members
440,017
Latest member
vasanrajeswaran

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top