Results 1 to 4 of 4

Thread: I'm getting old

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Angry

    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.

  2. #2
    Guest
    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

  3. #3
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    Check out the DateDiff Function should be something like this
    Code:
    txtDifference.Text = DateDiff("ww", txtTaxYearStart.Text, Date())

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width