-
I have posted this before and didn't really explain myself at all well...so here goes.
I've tried various ways of doing this, still without luck, any suggestions would be cool.
I've got a project where upon I would like to specify the current tax week based on a text box containing a date.
For instance:-
My Text Box "txtTaxYearStart" contains a date manually entered by a user, which is the date their company starts their tax year.
Now from "txtTaxYearStart" I would like to be able to work out the current tax week.
If there are ways to do this I would be extremely grateful if you could share them with me.
A pre-empted enourmous thanks are due.
-
Look up the Format function. I think it is something like:
Code:
txtAbsWeek = Format(txtUserDate, "WW", vbMonday)
txtThisWeek = Format(Now, "WW", vbMonday)
if txtThisWeek - txtAbsWeek > 0
taxWeek = txtThisWeek - txtAbsWeek
else
taxWeek = 52 + txtThisWeek - txtAbsWeek
end if
-
Check out the DateDiff Function should be something like this
Code:
txtDifference.Text = DateDiff("ww", txtTaxYearStart.Text, Date())
-
Thanks
Thanks for your replies.
I went for the following routiine:
code:--------------------------------------------------------------------------------
txtAbsWeek = Format(txtUserDate, "WW", vbMonday, vbFirstFullWeek)
txtThisWeek = Format(Now, "WW", vbMonday, vbFirstFullWeek)
if txtThisWeek - txtAbsWeek > 0
taxWeek = txtThisWeek - txtAbsWeek
else
taxWeek = 52 + txtThisWeek - txtAbsWeek
end if
Thanks RoyceWindsor1 for your help & also dcarlson :)