Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

intelligent form pay period

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
Currently I assign the pay period start date with the code below

Code:
Private Sub Form_Load()
Forms!frmloginout!txtStartDate.DefaultValue = "=Format(CDate('5/20/2006'), 'm/dd/yyyy')"
end sub

I want the code to be more intelligent and base the start date as it relates to the current date.
Example:
My pay periods are
5/20/2006
6/3/2006
6/17/2006
7/1/2006
7/15/2006
7/29/2006
8/12/2006
8/26/2006
9/9/2006
9/23/2006
Etc
Basically every 14 days

Know lets say that the current date is 8/15/2006 today
I want the form to be able to state that the start date is 8/12/2006


Any ideas how I can accomplish this task??


Newbie in search of knowledge
 

vttech,

One suggestion is to store your pay periods in a table. then you can create a function that will look up the current pay period based on the current date.

This way if you can control each period (in case they change).

 
You may try something like this:
Forms!frmloginout!txtStartDate.DefaultValue = "=Format((Date \ 14) * 14 + 7), 'm/dd/yyyy')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PVH:

I See that your code works but can you please Explain it

Thanks in Advance

Pwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top