I love DSUM (Not)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After much work have got the following Dsum to work on
the code event of a combo box change:

intRemainingPayment = DSum
("Ammount","tlbPayments","BookingID = " &
FORM_frmSubBookings!BookingID)

I now need to say:

and CustNo (in tlbPayments table) is the same as
FORM_frmCubCustomers.CustNo

Thanks for your help, I am almost there.
 
After much work have got the following Dsum to work on
the code event of a combo box change:

intRemainingPayment = DSum
("Ammount","tlbPayments","BookingID = " &
FORM_frmSubBookings!BookingID)

I now need to say:

and CustNo (in tlbPayments table) is the same as
FORM_frmCubCustomers.CustNo

Thanks for your help, I am almost there.

I would suggest the Combo box AfterUpdate event, not the change event.
What is the name of the form that this code is on?
If it is on the frm_SubBookings....
You can substitute the Me keyword in place of the form name.

If the name of the form with this code is frmSubBookings, you can use:

intRemainingPayment = DSum ("[Ammount]","tlbPayments","[BookingID] = "
& Me!BookingID & " and [CustNo] = " & Forms!frmCubCustomers!CustNo)

If this is on a different form, then:

intRemainingPayment = DSum ("[Ammount]","tlbPayments","[BookingID] = "
& Forms!NameOfForm!BookingID & " and [CustNo] = " &
Forms!NameOfOtherForm!CustNo)

The above assumes [CustNo] is a Number datatype field.
 
intRemainingPayment = DSum("Ammount","tlbPayments", _
"BookingID = " & FORM_frmSubBookings!BookingID & _
" And CustNo = " & FORM_frmCubCustomers.CustNo)
 

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

Similar Threads


Back
Top