Auto entry into field

S

Stephen

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

I have a 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. The payment Amount is usually the Amount Due.

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 slows 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. How else can I get the Amount Due without
opening the form it appears on?

Thanks
Stephen
..
 
G

Gerald Stanley

Have you considered taking it directly off the relevant
table using the DLookUp function rather than from a form.

Hope This Helps
Gerald Stanley MCSD
 
S

Steve

The amount due is a calculated field
-----Original Message-----
Have you considered taking it directly off the relevant
table using the DLookUp function rather than from a form.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a sales/products database that I track orders and
payments.

I have a 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. The payment Amount is usually the Amount Due.

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 slows 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. How else can I get the Amount Due without
opening the form it appears on?

Thanks
Stephen
..


.
.
 
G

Gerald Stanley

Can it be calculated from the underlying tables using the
DSum function?

Gerald Stanley MCSD
-----Original Message-----
The amount due is a calculated field
-----Original Message-----
Have you considered taking it directly off the relevant
table using the DLookUp function rather than from a form.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a sales/products database that I track orders and
payments.

I have a 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. The payment Amount is usually the Amount Due.

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 slows 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. How else can I get the Amount Due without
opening the form it appears on?

Thanks
Stephen
..


.
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top