Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    UK
    Posts
    82

    Exclamation Unanswered: invoice due dates

    i am trying to add account invoicing statements to my DB application.

    if an invoice is created on 15/11/2006 i need to populate a text box on a form with a payment due date of the 28th of the following month.

    does anyone have any suggestions.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    There's probably a fancier way of doing this, using date handling functions, but

    A) I don't do much more complicated date stuff then DateAdd
    B) I'm across the pond from you, and so my PC isn't set up for British formatted dates like 15/11/2006

    But the following does the job treating the dates as strings:

    Code:
    Private Sub InvoiceDate_AfterUpdate()
     If Mid(InvoiceDate, 4, 2) <= 11 Then
       DueDate = 28 & "/" & Mid(InvoiceDate, 4, 2) + 1 & "/" & Right(InvoiceDate, 4)
     Else
       DueDate = 28 & "/" & 1 & "/" & Right(InvoiceDate, 4) + 1
     End If
    End Sub
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sorry, hit the send key too soon! Just was going to say that I put the code behind the After_Update event, but of course it could go behind a button or other event, depending on your needs.
    Last edited by Missinglinq; 11-13-06 at 07:55.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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