I searched for "appending date entry on form" and come up with over 1600 results with about 1 out of ten having to do with date(s) at all!! So, after reading tons of the results, I decided to do the newbie thing and go ahead and post my issue (I am after all at work and have many other projects to work on!)... so here it is:
I have a program that retrieves data out of several database tables and prepares a report based upon the user's inputs. One of the inputs is a simple date entry form field in the format of: MM/DD/YYYY
The operator is to enter 6 days prior to today's date in the above field. For example:
Today's date is 04/12/2012
Operator enters 04/6/2012
I need this done automatically with this Macro Scheduler. I have the rest figured out(with the exception of one more item)...
There is one more field that gets populated by the operator. It is a drop-down selection of 5 items: Monday thru Friday.
The operator selects tomorrow's day and when it's Friday, the operator selects Monday, same for Sat and Sun. I was using MouseMove to the next coordinates and lclicking, but this means I would have to have a different script for each day, not to mention that this needs to be run for 12 different reports each day!
Can anyone help out a poor beginner IT tech?!? I know a tad of VB, so the VB datediff is where I think I need to head towards, I just don't know the details of that function very well...
Thank you soooo much for any assistance!
Scott
Appending Date Entry...
Moderators: Dorian (MJT support), JRL
Try these. Let us know how it goes.
Code: Select all
VBSTART
VBEND
Let>DaysAgo=6
VBEval>Right("0" & Month(now-%DaysAgo%),2) & "/" & Right("0" & Day(now-%DaysAgo%),2) & "/" & Year(now-%DaysAgo%),ago
MDL>ago
VBEval>weekday(date),today
If>{(%today%>1)and(%today%<6)}
Add>today,1
Else
Let>Today=2
EndIf
VBEval>weekdayname(%today%),nextday
mdl>nextday
Macro Scheduler 13 has DateAdd now.
Code: Select all
GetDate>today
DateAdd>today,D,-6,SixDaysAgo
mdl>SixDaysAgo
Rain -
That's what I ended up doing! Thanks!
Now, for DayOfWeek, appending that by 2 days so it looks like:
DayOfWeek>someVar
someVar2=someVar+2
if someVar2="3" //(Wednesday)
then
Press Down
Press Down
Press Down
Press Enter
elseif someVar2="4" //(Thursday)
then
Press Down
Press Down
Press Down
Press Down
Press Enter
Elsif someVar2="5' //(Friday)
then
Press Down
Press Down
Press Down
Press Down
Press Down
Press Enter
ElseIf someVar2="6" //(Monday)
then
Press Down
Press Enter
ElseIf someVar2="7" //(Tuesday)
then
Press Down
Press Down
Press Enter
Still struggling with it... will get it eventually!
Thanks!
Scott
That's what I ended up doing! Thanks!
Now, for DayOfWeek, appending that by 2 days so it looks like:
DayOfWeek>someVar
someVar2=someVar+2
if someVar2="3" //(Wednesday)
then
Press Down
Press Down
Press Down
Press Enter
elseif someVar2="4" //(Thursday)
then
Press Down
Press Down
Press Down
Press Down
Press Enter
Elsif someVar2="5' //(Friday)
then
Press Down
Press Down
Press Down
Press Down
Press Down
Press Enter
ElseIf someVar2="6" //(Monday)
then
Press Down
Press Enter
ElseIf someVar2="7" //(Tuesday)
then
Press Down
Press Down
Press Enter
Still struggling with it... will get it eventually!
Thanks!
Scott