473,398 Members | 2,404 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,398 software developers and data experts.

How to automatically have the 1st day of the week entered in a text box on a report?

Daniel B
I have a report that generates the total hours worked by each crew member. When the report is opened, it asks you to enter the starting and ending date of the time period that members of the crew have worked in order to generate the total amount of hours. I also have a text box labeled "week starting" and then the date.

The problem is, that when the report is generated the "week starting" date is not always the first day of that week, but rather the first day that the first crew member on the list worked. I am not very familiar with the database I am dealing with, so I do not how that date is being generated.

If you have any suggestions or advice it would be greatly appreciated. Also if you need more of an explanation I would be happy to elaborate.

Thanks, Dan B
Jun 16 '11 #1
6 3542
Rabbit
12,516 Expert Mod 8TB
Assuming that you mean Monday when you say 1st day of the week, you can calculate it by taking the day of the week you're on, adding 5, modding by 7, and then subtracting the current day by that many days.

Expand|Select|Wrap|Line Numbers
  1. x = current day of week
  2. y = monday of that week
  3. d = current date
  4.  
  5. y = d - ((x + 5) Mod 7)
Jun 16 '11 #2
Thank you for your help. However, Monday is not always the first day of the week. The company for which this DB was built sometimes has shutdown days on Mondays every other month or so.

As I said in my first thread, the parameters for entering the starting date of the period are usually going to be the first day of that week. I am wondering if once entering that start date, could I make it automatically fill in this other date as the one that was entered?
Jun 20 '11 #3
Rabbit
12,516 Expert Mod 8TB
You can take the min date of the dates entered where the week number and year of the date is equal to the current date.
Jun 20 '11 #4
NeoPa
32,556 Expert Mod 16PB
Daniel, what are you actually asking for here? It seems you already have a TextBox control that reflects the date of the first day of the week. Clearly then, you're not asking for that (which was the impression from the question), so what is it you require?
Jun 20 '11 #5
Okay.. when the report is opened you have to enter a start date and ending date. I would like to have this "week starting" textbox display the same date as the entered start date.
Jun 20 '11 #6
NeoPa
32,556 Expert Mod 16PB
Ah. That makes more sense now. You would like to get access to the value entered into the query that the report is bound to. I'm not sure that is possible the way you have it designed (as a parameter in your query). I'm open to being proven wrong here. There may be a dataset object for the report that contains the parameters and their current values, but I don't know of it being able to be used in that context (and I wouldn't hold your breath).

An alternative (and more usual) design is to enter these values into controls on your form instead and open the report using a filter made up from the data in these controls. That way the code within the report can get the info by either :
  1. Referring to the controls on the form.
  2. Parsing its .Filter property for both values.
Jun 20 '11 #7

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

Similar topics

2
by: Earl Anderson | last post by:
Reading Google archives, I found a quick and simple solution from Allen Browne of having a "Day of Week" textbox automatically filled from a separate date field textbox. I put the function {...
3
by: David | last post by:
Hello, hope someone can help. I have a request to print word .doc check lists with selected records in Access for surgery procedure cards. I have hyperlinked the word doc's to a field in each...
1
by: David Smith | last post by:
What I want to be able to do: A textbox is available that the user can enter information into. Specifically (for the purposes of this post), the user is asked to enter a number, and that number...
2
by: jnikle | last post by:
I'm stumped on this one. I have a report that shows production calculations for a user-selected period divided up into weeks. Currently, I just use format(,"ww") to get the calendar week for...
1
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't...
2
by: David | last post by:
I have VB6 app that generates a report using the Printer object. It basically was an old text report that i generated using Print# statements. I am wondering if the Printer object has changed...
8
by: unkietee | last post by:
Hi Experts, my first post here! I hope you can help me. I have a basic form which I want the user to enter either a number (postcode/zipcode) or text (suburb). When they hit submit I want to...
2
by: mahesh123 | last post by:
Hi Folks, I am generating the text reports from the visual basic 6.0. while printing the text report the Char(12) ie page break character is not recognising. Is there any alternate Solution for...
6
by: yusufjammy | last post by:
Hi i am newbie in visual basic ? How to automatically write in text box without keyboard with visual basic.net .. And what is .net(dotnet) ?
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.