473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Day of week

46
Hi,

I am using Access 2007. I have a report that has labels that need to be visible only on certain days of the week.
I have tried the following code in the reports load event, but it doesn't work. Does anybody have any ideas?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Load()
  2. Dim vDay As VbDayOfWeek
  3. If vDay = vbMonday Then
  4. Me.Label0.Visible = True
  5. Else
  6. Me.Label0.Visible = False
  7. End If
  8. End Sub
  9.  
thanks,
Jeff
Nov 12 '10 #1

✓ answered by ADezii

  1. vbDayOfWeek is an Enumeration which is illustrated below:
    Expand|Select|Wrap|Line Numbers
    1. Enum vbDayOfWeek
    2.   vbSunday = 1
    3.   vbMonday = 2
    4.   vbTuesday = 3
    5.   vbWednesday = 4
    6.   vbThursday = 5
    7.   vbFriday = 6
    8.   vbSaturday = 7
    9. End Enum
  2. An example of its possible usage would be:
    Expand|Select|Wrap|Line Numbers
    1. Dim dteDate As Date
    2.  
    3. dteDate = #11/12/2010#
    4.  
    5. If Weekday(dteDate) = vbFriday Then         'will evaluate to True
    6.   MsgBox "Finally, the work week is over!"
    7. Else
    8.   'Day other than Friday
    9. End If

4 7299
ADezii
8,834 Expert 8TB
  1. vbDayOfWeek is an Enumeration which is illustrated below:
    Expand|Select|Wrap|Line Numbers
    1. Enum vbDayOfWeek
    2.   vbSunday = 1
    3.   vbMonday = 2
    4.   vbTuesday = 3
    5.   vbWednesday = 4
    6.   vbThursday = 5
    7.   vbFriday = 6
    8.   vbSaturday = 7
    9. End Enum
  2. An example of its possible usage would be:
    Expand|Select|Wrap|Line Numbers
    1. Dim dteDate As Date
    2.  
    3. dteDate = #11/12/2010#
    4.  
    5. If Weekday(dteDate) = vbFriday Then         'will evaluate to True
    6.   MsgBox "Finally, the work week is over!"
    7. Else
    8.   'Day other than Friday
    9. End If
Nov 12 '10 #2
jmar93
46
Works perfectly, thank you very much!

Jeff
Nov 12 '10 #3
ADezii
8,834 Expert 8TB
You are quite welcome.
Nov 12 '10 #4
just use the function
myday = WeekdayName(Weekday(mydate.Text) - 1)
on the current date to return the current day, I have a small testbed attached which shows this on form1.
Attached Files
File Type: zip testbed.zip (59.0 KB, 166 views)
Nov 13 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
21
by: .:mmac:. | last post by:
I have to update a page every week. I get the page ahead of time so I used the "scheduled includes" webbot in Frontpage only to find that I would have to refresh the page every week to have it...
7
by: Shuffs | last post by:
Could someone, anyone please tell me what I need to amend, to get this function to take Sunday as the first day of the week? I amended the Weekday parts to vbSunday (in my code, not the code...
14
by: deko | last post by:
This runs, but does not narrow to current week. suggestions appreciated! SELECT lngEid, dtmApptDate, Subject, Appt_ID FROM qry002 WHERE (dtmApptDate BETWEEN DateAdd("d",-weekday()+2,) And...
5
by: Peter Bailey | last post by:
I have a query that returns , and : 12/05/04 3 Wednesday 13/05/04 0 Thursday and so on what I would like to do now is count the number of bookings by week so from monday to...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
3
by: Steph. | last post by:
Hi, When I use the "Calendar.GetWeekOfYear" function (with "fr-BE" as CultureInfo and Monday as the first day of week) I get : Friday 31/12/2004 : week = 53
3
by: Mal | last post by:
Hello, Any advice on a function to convert a given week number to a date? Ideally I'd like the first day of that week. I'm using this to compare year to year....using the week number as the...
6
by: aarklon | last post by:
Hi folks, I found an algorithm for calculating the day of the week here:- http://www.faqs.org/faqs/calendars/faq/part1/index.html in the section titled 2.5 what day of the week was 2 august...
10
by: Jim | last post by:
I'm sure this has been asked before but I can't find any postings. I have a table that has weekly inspections for multiple buildings. What I need to do is break these down by the week of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.