How can I update a combo control on a form to reflect the latest value entered in another form?
I have a payment form which updates the subscribers form on the afterupdate event. The only control which updates is the paidthrough control. I need to also have the payment type update. I have included the code on the Payment Form. You will note that not all payment types are considered. What am I doing wrong? Is the problem because it is a combo box? If so, how to fix? Thanks...
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Check to make sure a payment type (individual, family etc.) is selected, then update
' the PaidThrough field (in the Subscribers table)
Dim bytMonths As Byte
'Dim PaymentType As Variant
If PaymentType = 0 Then
DisplayMessage "You must select a payment type."
'Return to the subscriber form and do not save the payment entry.
Cancel = True
Exit Sub
End If
'If this payment is for more than 1 year, multiply by 12 to calculate the
'new paid through date.
bytMonths = YearsPaid * 12
'Keep a going and
Select Case PaymentType
'do not include misc, building fund and any other payment
'type not directly related to membership dues.
Case 22, 23, 24, 25, 26
If IsNull(PaidThrough) Or PaidThrough < Date Then
' If this is the first payment, or the the paid through date
'is before today's date, meaning the membership has lapsed
'set PaidThrough date 12 months from CURRENT date.
PaidThrough = DateSerial(Year(Date), Month(Date) + bytMonths, 1)
Else
' Otherwise, add additional months to the EXISTING PaidThrough value.
PaidThrough = DateSerial(Year(PaidThrough), Month(PaidThrough) + _
bytMonths, 1)
PaymentType = PaymentType
End If
'Continue to ignore non-membership related payments
Case 27, 28, 29
Exit Sub
Case Else
End Select
End Sub
Private Sub Form_AfterUpdate()
' Update other forms if they are open.
If IsOpen("Subscribers") Then
' Refresh the Subscribers form to show
' the new PaidThrough value.
Forms!Subscribers.Refresh
End If
If IsOpen("PaymentHistory") Then
' Requery the PaymentHistory pop-up form
' to show the new payment.
Forms!PaymentHistory.Requery
End If
End Sub
I have a payment form which updates the subscribers form on the afterupdate event. The only control which updates is the paidthrough control. I need to also have the payment type update. I have included the code on the Payment Form. You will note that not all payment types are considered. What am I doing wrong? Is the problem because it is a combo box? If so, how to fix? Thanks...
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Check to make sure a payment type (individual, family etc.) is selected, then update
' the PaidThrough field (in the Subscribers table)
Dim bytMonths As Byte
'Dim PaymentType As Variant
If PaymentType = 0 Then
DisplayMessage "You must select a payment type."
'Return to the subscriber form and do not save the payment entry.
Cancel = True
Exit Sub
End If
'If this payment is for more than 1 year, multiply by 12 to calculate the
'new paid through date.
bytMonths = YearsPaid * 12
'Keep a going and
Select Case PaymentType
'do not include misc, building fund and any other payment
'type not directly related to membership dues.
Case 22, 23, 24, 25, 26
If IsNull(PaidThrough) Or PaidThrough < Date Then
' If this is the first payment, or the the paid through date
'is before today's date, meaning the membership has lapsed
'set PaidThrough date 12 months from CURRENT date.
PaidThrough = DateSerial(Year(Date), Month(Date) + bytMonths, 1)
Else
' Otherwise, add additional months to the EXISTING PaidThrough value.
PaidThrough = DateSerial(Year(PaidThrough), Month(PaidThrough) + _
bytMonths, 1)
PaymentType = PaymentType
End If
'Continue to ignore non-membership related payments
Case 27, 28, 29
Exit Sub
Case Else
End Select
End Sub
Private Sub Form_AfterUpdate()
' Update other forms if they are open.
If IsOpen("Subscribers") Then
' Refresh the Subscribers form to show
' the new PaidThrough value.
Forms!Subscribers.Refresh
End If
If IsOpen("PaymentHistory") Then
' Requery the PaymentHistory pop-up form
' to show the new payment.
Forms!PaymentHistory.Requery
End If
End Sub