I have a form that records dates of unavailability for a worker.
Based on what is entered in the simple table behind the form, many calculations take place to create employee "load" balance. Each day needs to be inserted as a separate row on the table.
Right now the users enter each date as a separate row.
They want to just be able to enter a range.
How do I add the multiple rows from the date range entered on the form AND exclude weekends?
4 4954 PEB 1,418
Expert 1GB
Hi Joanie,
you need to use a VB code to perform this task! Do you want to continue with the code? If yeah, can you tell me the names of your start date and your end date and when do you want that the dates are appended... And how do you see if once the specified range is entered... Maybe it's better to use a single form that it's not based on the form that you mention!
So do you want to proceed with VB code?
Best regards
Yes, VB code would be great.
So, here is how I see it working...
They have a form which has a person's name and the dates they will be absent: (begin & end date) October 14th -29th and hours gone per day (because some people will just be absent 4 hours on one day).
The code should insert rows into a table as follows:
John Smith, 10/14/2006, 8 (for 8 hours)
the next row would be
John Smith, 10/15/2006, 8
etc....
THANK YOU!!!!
Hi Joanie,
you need to use a VB code to perform this task! Do you want to continue with the code? If yeah, can you tell me the names of your start date and your end date and when do you want that the dates are appended... And how do you see if once the specified range is entered... Maybe it's better to use a single form that it's not based on the form that you mention!
So do you want to proceed with VB code?
Best regards
p.s. and it should exclude weekends.
PEB 1,418
Expert 1GB
Yes, VB code would be great.
So, here is how I see it working...
They have a form which has a person's name and the dates they will be absent: (begin & end date) October 14th -29th and hours gone per day (because some people will just be absent 4 hours on one day).
The code should insert rows into a table as follows:
John Smith, 10/14/2006, 8 (for 8 hours)
the next row would be
John Smith, 10/15/2006, 8
etc....
THANK YOU!!!!
Ok let's do it! :)
Imagine that on your form you have an Ok bouton to that is attached the function. On Click event, you choose event procedure.. Appears a white scrren of VB in which you have to place the following code: - Sub Ok_onclick()
-
Dim i
-
-
For i = int(Cvdate(Me!StartDate)) to int(Cvdate(Me!EndDate))
-
if (DatePart("w", i,vbMonday) <> 6) And (DatePart("w", i,vbMonday) <> 7) then
-
docmd.runsql "INSERT INTO Hours(Worker, Date, Time) VALEUS ('"+Me!WOrker+"',"+Format(i,"dd/mm/yyyy")+",8 );"
-
End if
-
Next i
-
-
End Sub
The only thing you have to do is to replace The fields and the table name....
Workers, Worker, Date, Time, StartDate End Date with the appropriate ones!
:)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: pbbriggs |
last post by:
I will try to be as descriptive as possible, but this error has me
stumped and I am not sure what relevant info to include....
I am running Access XP on a Windows XP machine. I initially began...
|
by: ImraneA |
last post by:
Hi there
Many thanks to those people who contributed to this group, helped me
greatly.
Enclose, my code, hope it helps others :-
Public Function Export_Excel_9(tbx1 As Variant, tbx2 As...
|
by: Ron Nolan |
last post by:
I have a large application that contains lots and lots of financial
history data.
The history data is currently set up in a table called 'TblHist' that
exists inside each of these three .mdb...
|
by: B Moor |
last post by:
Hello,
I am quite bogged down with this problem and would like some tips/help
if any one has any.
Thanks in advance.
The Problem
-----------
This system initially seemed quite stable for...
|
by: syounger |
last post by:
Hi. I have a report in Access 2000 that is based on selection made
from a series of interdependent list boxes. The boxes I have right now
are Source, Table, Column, Date. The user chooses Source...
|
by: Mell via AccessMonster.com |
last post by:
Is there a way to find out where an application was created from?
i.e. - work or home
i.e. - if application sits on a (work) server/network, the IT people know the
application is sitting...
|
by: c0dergirl |
last post by:
This c# program allows you to select multiple items from a listbox.
For each selected item, a worksheet is created in the workbook with
some information. Right now I create a chart that plots some...
|
by: awayne |
last post by:
I am working with MS VB 6.5. I am putting together a MS Access (MS Access 2000) database for work to keep track of the projects and their status that we've done. I use MS Access to run a "Make-table...
|
by: evenlater |
last post by:
I have an Excel workbook that I'm programming from Access. The rows in
the workbook vary in height. So let's say row 8 is taller than the
rows above it. If I *manually* insert 2 new rows at the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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: 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...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |