I want to transform a record by assigning 2 values and open a report
with these new values,but somehow i cannot do it.
I think that in order to get the best advice i need to explain at
first what i am trying to do and after that to show what i have done
with the errors.
Our idea is the following.If an order is paid, it is not an order
anymore and it becomes an invoice.The number of the invoice is the
field paymentid.If paymentid is 0, then
we have an order, if it is not,then we have an invoice.I use the DMax
in order to get the next number of the payment.
So i have a form and on it a list box called ListOrders.
The row source of the list box is :
SELECT orders.orderid, orders.orderdate, orders.paymentid
FROM orders
WHERE (((orders.paymentid)=0))
ORDER BY orders.orderdate;
My idea is to correlate the orderid from the list box with the orderid
of the form, set the DMax and the Date function, and open the report
with the new changes.But it is exactly in the correlation betwen
the listbox and the form where i get the error.
In the line Me![orderid] = Me![ListOrders]
i get the mesage you cant assign a value to this object.
My code on the button above the list bos is the following:
Dim stLinkCriteria As String
Dim stDocName As String
stDocName = "Invoice"
stLinkCriteria = "orderid = " & Me![ListOrders]
Me![orderid] = Me![ListOrders]
Me![paymentid] = DMax("[Paymentid]", "orders") + 1
Me![invoicedate] = Date
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
May i have the help ?