Forms Automatic Entry

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

I have a sales/products database that I track orders and
payments.

I have table set up for:
Customers
Orders
Order Details
Payments, etc.

I created a screen, through a query, that shows me all
orders shipped today and allows me to put in a payment
amount for an order.

In the AfterUpdate I put in the following code to allow
the automatic input of the PaymentAmount into the Amount
Due Field.

Private Sub PaymentMethodID_AfterUpdate()


DoCmd.OpenForm "Orders by Customer Subform for
Payments", , , "[OrderID] = [Forms]![Daily Delivery
Posting Form].Form![OrderID]"

If IsNull(Me![PaymentAmount]) Then
Me![PaymentAmount] = [Forms]![Orders by Customer Subform
for Payments].Form![Amount Due]

End If
DoCmd.Close

Exit Sub
This works ...but it slow down the program because I open
and close a form (Orders by Customer Subform for
Payments) with every entry. There must be a better way.
Please help.

Thanks
Stephen
 
Sorry, but I'm a little confused about your question.

Seems to me you could use a Me.Recalc to recalculate your
form On Exit of the last Field the User inputs data
needed to complete your calculation

Private Sub PaymentAmount_On_Exit()
--- Apply calculation here ---
Me.Recalc

....not understanding why you are opening the other form.
If you are pulling data from that form, seems like you
could utilize an SQL statement at the calculation point.

Me.PaymentAmount=db.Execute("SELECT [Orders by Customer
Subform for Payments]![Amount Due] As AmountDue FROM
[Orders by Customer Subform for Payments]![Amount Due];")

Sorry I cannot create the SQL completely for you, but I
don't know how your exact Tables / Queries / Forms are
set up. Chances are you will need a WHERE Statement to
specify the Amount Due associated with the Current
Record's data.
 
Back
Top