Compare Date

M

Mike

Hi all,

I have two unbound textbox , begin date and end date. I
created a button to check that the begin date can not be
greateer than the end date and if the begin date is
greater than the end date, a message box pops up. But my
problem is that I'm gettingthe message pop up regardless
of any date. So how do I compare the dates in the two
textboxes.

Here is the line that does the checking:

Dim begindate as date
Dim enddate as date

begindate=Me.textbox1
enddate=Me.textbox2

If begindate > enddate then

do something here...

Thanks for the help.

mike
 
J

Joe Voll

Dim begindate as date
Dim enddate as date

begindate=Me.textbox1
enddate=Me.textbox2

If begindate > enddate then

try the following

begindate = datevalue(me.textbox1)
begindate = datevalue(me.textbox2)

Joe.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top