Onclose command

coolcatkelso

Registered User.
Local time
Today, 20:53
Joined
Jan 5, 2009
Messages
279
Hiya

The form I'm working on is Workorders, the related form is Payments

I have the following fields (basic) in the Workorder form

Subtotal
Sales Tax
Payments
Amount Due

If I fill out a new Workorder and refresh the page everything looks good

Lets say it looks like this

Subtotal 1.31
Sales Tax 0.00
Payments 0.00
Amount Due 1.31

Looks correct.. But if I close the form and go back to the main page which has a field called - Total Payments, Amount Due etc as a brief display

THe Total Payment field is blank and will not display a Number in the Amount Due either.. I've play about with the form and found that if I goto the Payments form and select Payment amount is ?0.00 then it works

So, somehow, is there a way I can have on the Workorder form something like a bit of code that will - Onclose place this ?0.00 data entry to the form, which will in turn, show the ?0.00 on the other related form?

Kind of hard to explain lol sorry
________
Terpsichore
 
Last edited:
Heres the code for the Payment Form

Code:
Option Compare Database
Option Explicit

Private Sub Form_Open(Cancel As Integer)
    If Not IsLoaded("Workorders by Customer") Then
        MsgBox "Open the Payments form using the Payments button on the Workorders by Customer form."
        Cancel = True
    End If
End Sub
Private Sub Form_Activate()
On Error GoTo Err_Form_Activate
    Me.Requery
Exit_Form_Activate:
    Exit Sub
Err_Form_Activate:
    MsgBox Err.Description
    Resume Exit_Form_Activate
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
On Error GoTo Err_Form_BeforeInsert
    Me![PaymentDate] = Date
    Me![PaymentAmount] = [Forms]![Workorders by Customer]![Workorders by Customer Subform].Form![Amount Due]
Exit_Form_BeforeInsert:
    Exit Sub
Err_Form_BeforeInsert:
    MsgBox Err.Description
    Resume Exit_Form_BeforeInsert
End Sub

Private Sub PaymentMethodID_NotInList(NewData As String, Response As Integer)
    MsgBox "Double-click this field to add an entry to the list."
    Response = acDataErrContinue
End Sub
Private Sub PaymentMethodID_AfterUpdate()
On Error GoTo Err_PaymentMethodID_AfterUpdate
    If Not IsNull(Me![PaymentMethodID]) Then
        If Me![PaymentMethodID].Column(2) = True Then
            Me![CardholdersName] = [Forms]![Workorders by Customer]![FirstName] & " " & [Forms]![Workorders by Customer]![LastName]
        End If
    End If
Exit_PaymentMethodID_AfterUpdate:
    Exit Sub
Err_PaymentMethodID_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_PaymentMethodID_AfterUpdate
End Sub
Private Sub PaymentMethodID_DblClick(Cancel As Integer)
On Error GoTo Err_PaymentMethodID_DblClick
    Dim lngPaymentMethodID As Long
    If IsNull(Me![PaymentMethodID]) Then
        Me![PaymentMethodID].Text = ""
    Else
        lngPaymentMethodID = Me![PaymentMethodID]
        Me![PaymentMethodID] = Null
    End If
    DoCmd.OpenForm "Payment Methods", , , , , acDialog, "GotoNew"
    Me![PaymentMethodID].Requery
    If lngPaymentMethodID <> 0 Then Me![PaymentMethodID] = lngPaymentMethodID
Exit_PaymentMethodID_DblClick:
    Exit Sub
Err_PaymentMethodID_DblClick:
    MsgBox Err.Description
    Resume Exit_PaymentMethodID_DblClick
End Sub
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

    DoCmd.Close
Exit_Command11_Click:
    Exit Sub
Err_Command11_Click:
    MsgBox Err.Description
    Resume Exit_Command11_Click
    
End Sub

Again, all I need it to do is add ?0.00 as the data entry, doing it as Default Value doesn't seem to work.. Works ok on display, but doesn't save it to the Table
________
LovelyWendie
 
Last edited:

Users who are viewing this thread

Back
Top Bottom