Microsoft Access Date

35 pts.
Tags:
Access 2003
Access Functions
Microsoft Access
Microsoft Access 2003 I have a Today button that uses the command.. Private Sub cmdtoday_Click() 'Sets the Date From and Date To text boxes 'to Today's Date Me!OSJPQFrom = Date Me!OSJPQTo = Date End Sub To put Today's date into my From and To Date fields. The problem is I have these From and To fields on the same forum as the records. When you press the Today button, it pulls the date from that current record. How do I get it to pull the actual date?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Let me update for clarification.

I am following the example at <a href=”http://www.databasedev.co.uk/report_date_parameters.html”>http://www.databasedev.co.uk/report_date_parameters.html</a>

I have my user date entry fields on the same page as my records. I have been able to fix my Today button by switching ‘Date’ to ‘Now’

The question is, How do I change the others (Week and Month) to reflect a week based off ‘Now’ s Date.

Private Sub cmdweek_Click()
‘Sets the Date From and Date To text boxes
‘to show complete working week (Mon – Fri)

Dim today

today = Weekday(Date)

Me!txtdatefrom = DateAdd(“d”, (today * -1) + 2, Date)
Me!txtDateTo = DateAdd(“d”, 6 – today, Date)

End Sub

Private Sub cmdmonth_Click()
‘Sets the Date From and Date To text boxes
‘to show complete month (from start to end of current month)

Me!txtdatefrom = CDate(“01/” & Month(Date) & “/” & Year(Date))
Me!txtDateTo = DateAdd(“d”, -1, DateAdd(“m”, 1, Me!txtdatefrom))

End Sub

Private Sub cmdyear_Click()
‘Sets the Date From and Date To text boxes
‘to show complete current year

Me!txtdatefrom = CDate(“01/01/” & Year(Date))
Me!txtDateTo = DateAdd(“d”, -1, DateAdd(“yyyy”, 1, Me!txtdatefrom))

End Sub

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Jrb
    How do I convert a date in an access query ? example 112508 to 08/25/11
    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following