Update and lock records

M

Marianne

Greetings!

Some day I hope to be really good at this, but that day <> today! So I
welcome your suggestions.

I am creating a db for simple invoicing, and payment history. no inventory
or purchasing. Invoices can have multiple line items. Each line item can have
multiple payments.

FrmInvoice1Edit - Main Form containing a tab control with 2 subforms
frmInvoiceDetail1Edit and frmPayments1Edit

when an invoice line item is paid in full:

The Paid field on frmInvoiceDetail1Edit should be set to True
the line item record in frmInvoiceDetail1Edit and frmPayments1Edit should be
locked to further editing, but without locking the rest of the unpaid
records and requery the data in a combobox that lists the available line
items that can be paid.

I put this code in the Form's after update event but get a Error 13 type
mismatch when the record tries to update. Don't know what to do to lock the
records.

Dim strTotalPymts As String
Dim strExtAmt As String
Dim varPaid As Variant

' Domain Sum to sum all the payments for each line item
strTotalPymts = DSum("Pymt", "PaymentDetail", "[PymtInvID] = " &
Me.PymtInvID And "[InvLineNum] =" & Me.InvLineNum)

strExtAmt = Forms!frmInvoice1Edit!frmInvoiceDetail1Edit.Form!ExtAmt
varPaid = Forms!frmInvoice1Edit!frmInvoiceDetail1Edit.Form!Paid

If strTotalPymts = strExtAmt Then varPaid = True
Me.cboSelectPaymentsList.Requery
 
M

Mike Painter

Marianne said:
Greetings!

Some day I hope to be really good at this, but that day <> today! So I
welcome your suggestions.

I am creating a db for simple invoicing, and payment history. no
inventory or purchasing. Invoices can have multiple line items. Each
line item can have multiple payments.

FrmInvoice1Edit - Main Form containing a tab control with 2 subforms
frmInvoiceDetail1Edit and frmPayments1Edit

when an invoice line item is paid in full:

The Paid field on frmInvoiceDetail1Edit should be set to True
the line item record in frmInvoiceDetail1Edit and frmPayments1Edit
should be locked to further editing, but without locking the rest of
the unpaid records and requery the data in a combobox that lists the
available line items that can be paid.
Payment records shold be locked when they are done and any adjustment should
be a separate line item. (Five years dating an accountant.)
I put this code in the Form's after update event but get a Error 13
type mismatch when the record tries to update. Don't know what to do
to lock the records.

Dim strTotalPymts As String
Dim strExtAmt As String
Dim varPaid As Variant

' Domain Sum to sum all the payments for each line item
strTotalPymts = DSum("Pymt", "PaymentDetail", "[PymtInvID] = " &
Me.PymtInvID And "[InvLineNum] =" & Me.InvLineNum)

strExtAmt = Forms!frmInvoice1Edit!frmInvoiceDetail1Edit.Form!ExtAmt
varPaid = Forms!frmInvoice1Edit!frmInvoiceDetail1Edit.Form!Paid

If strTotalPymts = strExtAmt Then varPaid = True
Me.cboSelectPaymentsList.Requery

I don't see any code updaaing records

varPaid = Forms!frmInvoice1Edit!frmInvoiceDetail1Edit.Form!Paid
I don't see that the above is needed
If strTotalPymts = strExtAmt Then
Me.Paid = True
else
Me.Paid = False
end if

Without the else statement I can make a payment, get the item marked paid
and then reverse the entry and it stays paid.
 

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