Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date function (Acces 2000)

    I have a code to transform the order into invoice.This code has been made with the help of Hans the Moderator.
    Later on I came accross difficulties with assigning the invoicedate of the table order to the present date.
    I want to use the inbuilt function Date().

    The Microsoft Jet Database cannot find a record in the table customers with key matching fields customerid

    Could you help me asssign the present date to the field invoicedate when trnaforming the order?
    I am applying the database

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date function (Acces 2000)

    How and where do you want to set the invoice date? In the code that transforms an order to an invoice, or separately?

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date function (Acces 2000)

    Thank you for your prompt reply.I want to set my invoicedate in the control called Command582 and named
    Transformorder.I have also used a function called finvoidedate that may be irrelevant.I need to fill in the
    present date in the field invoidedate and save it for the invoice.When i open the report the present date of the control
    should be available

    kind regards

  4. #4
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date function (Acces 2000)

    just to add that the field invoicedate is in the table orders

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Date function (Acces 2000)

    Try this version of the On Click proecedure of the command button:

    Private Sub Command582_Click()
    Dim lngNextID As Long
    Dim strSQL As String
    ' Did user select an order?
    If Me.ListOrders.ListIndex = -1 Then Exit Sub
    ' Get next payment ID
    lngNextID = Nz(DMax("PaymentID", "Orders"), 0) + 1
    ' SQL for update query
    strSQL = "UPDATE Orders SET PaymentID = " & lngNextID & _
    ", InvoiceDate = Date()" & _
    " WHERE OrderID = " & Me.ListOrders
    CurrentDb.Execute strSQL
    Me.ListOrders.Requery
    DoCmd.OpenReport "Invoice", acViewPreview, , "paymentid = " & lngNextID
    End Sub

    The added code is indicated in bold text.

  6. #6
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date function (Acces 2000)

    Wonderful !
    Thank youu so much ! I have now a bulletproofed solution

Posting Permissions

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