var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Need Help with Syntax of "Week Ending Date Calculation"
I'd like to use this in one of my fields. Basically it would take another field ( that is populated by the =now() function) and figure out the week ending date.
Public Function FindSaturday(InputDate As Date)
' Returns the date of the first Saturday following the Inputdate
FindSaturday = FormatDateTime(InputDate + (7 - Weekday(InputDate)))
Can somone help?
I put this code in a module.
Function FirstSAT(txtDate As Date) As Date
Dim DayOfWeek, AddDays As Integer
DayOfWeek = Weekday(txtDate)
AddDays = 7 - DayOfWeek
FirstSAT = txtDate + AddDays
Then call the function from VBA (assuming you are populating a textbox called txtFirstSAT).
Call it right after the code that is populating the other field.
me.txtFirstSAT = basModule.FirstSAT(DateValue)
Hope this helps!
Last edited by Cosmos75; 07-16-04 at 16:39.
What should (DateValue) equal? Now()?
You said that there is "another field ( that is populated by the =now() function)". That should be used in the formula of do something like
Originally Posted by joshua310
DateToUse = Now()
me.txtOtherField = DateToUse
me.txtFirstSAT = basModule.FirstSAT(DateToUse)
Er, I may have misunderstood but why not enter the following directly in the Control Source property?
Unless of course the field is a bound control in which case you must poke the value in programmatically.
Last edited by Rod; 07-18-04 at 09:44.