Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a variable into a date #MM/DD/YYYY# 1

Status
Not open for further replies.

Cleis

Technical User
Jun 4, 2000
197
US
Group:

I have a form that has a text box that has the year. I want to pass it as a variable into the following:

Me!txtFileAvg = DateDiff("d", #1/30/2007#, [txtFileDate])

How do I do this?

This is on the after update event of a check-box.

Thanks!


Itch


 
One way:
Me!txtFileAvg = DateDiff("d", DateSerial(Me![your textbox], 1, 30), [txtFileDate])

Another way:
Me!txtFileAvg = DateDiff("d", CDate("1/30/" & Me![your textbox]), [txtFileDate])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV!

Thanks! I knew it was something simple! By the way I used your second example because the month and day are constants (except for Feb where Iused the 28th)

Here is a star for your time!


Itch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top