Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Weekday Function

Weekday Function

Weekday Function

I am totally frustrated trying to use the weekday function in a statement thus:
Day% = Weekday(ThisMonth%/1/ ThisYear%)

I get Day% = 7 (should be 4) when ThisMonth% = 3 and ThisYear% = 2000 (values checked with Breakpoint on next line). What the #$%@# gives with this thing?

(Have tried putting the date expression into a variant and then performing Weekday on variant, putting #'s outside the expression, using commas instead of /'s)

Any insight into this glitch will be greatly appreciated!

Jeff Roberts

RE: Weekday Function

Try this,

Dim MyDate As Date
Dim MyWeekDay As Integer

MyDate = DateSerial(ThisYear%, ThisMonth%, 1)
MyWeekDay = Weekday(MyDate)

Hope this helps!

RE: Weekday Function

Thank you VB400--it works perfectly! (Why the heck didn't it work the other way???)

RE: Weekday Function

Here's the reason it didn't work:

The expression

ThisMonth%/1/ ThisYear%

actually means ThisMonth divided by 1 divided by ThisYear.

To get the results you expected, you need to concatenate the values like this:

ThisMonth & "/1/" & ThisYear

nick bulka

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close