Northwind 2007 questions

tonysi

New member
Local time
Today, 05:08
Joined
Dec 5, 2012
Messages
4
I am new to this forum and even new in database.
I hope that I post in the right section.
I have question about northwind access database 2007.

Hopefully anyone can help me to understand this and thank you for your help.

1. In northwind access database, there is invoices table. My question is why does the amount due is blank even after iIcomplete the order?

2. Then I go to customerorders modules the code to create invoices

Function CreateInvoice(OrderID As Long, Amt As Currency, InvoiceID As Long) As Boolean
Dim rsw As New RecordsetWrapper
If rsw.OpenRecordset("Invoices") Then
With rsw.Recordset
If Not rsw.AddNew Then Exit Function
![Order ID] = OrderID
![Amount Due] = Amt
If rsw.Update Then
.Bookmark = .LastModified
InvoiceID = ![Invoice ID]
CreateInvoice = True
End If
End With
End If
End Function

I can see that it says ![Amount Due] = Amt.

Then I checked the button create invoice code

Private Sub cmdCreateInvoice_Click()
Dim OrderID As Long
Dim InvoiceID As Long

OrderID = Nz(Me![Order ID], 0)

' Gracefully exit if invoice already created
If CustomerOrders.IsInvoiced(OrderID) Then
If MsgBoxYesNo(OrderAlreadyInvoiced) Then
CustomerOrders.PrintInvoice OrderID
End If
ElseIf ValidateOrder(Invoiced_CustomerOrder) Then

' Create Invoice Record
If CustomerOrders.CreateInvoice(OrderID, 0, InvoiceID) Then

' Mark all Order Items Invoiced
' Need to change Inventory Status to SOLD from HOLD
Dim rsw As New RecordsetWrapper
With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset)
While Not .EOF
If Not IsNull(![Inventory ID]) And ![Status ID] = OnHold_OrderItemStatus Then
rsw.Edit
![Status ID] = Invoiced_OrderItemStatus
rsw.Update
Inventory.HoldToSold ![Inventory ID]
End If
rsw.MoveNext
Wend
End With

' Print the Invoice
CustomerOrders.PrintInvoice OrderID

SetFormState
End If
End If
End Sub

I couldn't find "amt" in this code that is why it didn't sore value in invoices table. I think I will have to create a text box and called it "amt" so every time I click create invoices, it will store anything in amt text box.
Anyone can help me how to store the amount due in invoices table?
Thank you and I am sorry for my English.
 
Function CreateInvoice(OrderID As Long, Amt As Currency, InvoiceID As Long)

I haven't reviewed your code in detail, and I don't have acc2007, but I have identified where Amt is coming from.
 

Users who are viewing this thread

Back
Top Bottom