How to load data from a form to a subform

J

Joe Cilinceon

I have a Payment Form that has some fields Rent, Late Fees, LockCutFee,
AuctionFee charges shown across the top. These are filled from a BalanceDue
query. Now if I want to pay these charges I have a button on the form that I
want to add this to a sub form I'll call PaymentCharges. The PaymentCharges
subform is based on a temp table that will have 3 fields per record,
Transaction (will be the same for all records), ChgID and ChgAmt. This will
require at least 1 record and possibly 4. I don't want to add say an Auction
Fee unless > 0 value. I'm doing it now using the SQL show below which shows
the Rent charge being added. This will always add when the button is hit:

Append charges to PaymentCharges Table
strSQL = "INSERT INTO PaymentCharges ( Transaction, ChgID, ChgAmt)"
strSQL = strSQL & " SELECT "
strSQL = strSQL & Me.txtTrans & " AS Transaction, "
strSQL = strSQL & 1 & " AS ChgID, "
strSQL = strSQL & Me.txtRentOwed & " AS ChgAmt ;"

'DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
'DoCmd.SetWarnings True
'Refresh the form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Now I know I can do this for rest of the charges wrapped in an If Then
statement where their values are >0 but was looking for another method of
doing this.
 

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