Hiding controls in a subform only when adding new records

essence

Registered User.
Local time
Today, 06:25
Joined
Nov 20, 2006
Messages
21
Hello,

I have a main form, "frmProjects" and a subform, "subformFinancials". It is used to track project information.

This form is to view, edit and add new records. The user is allowed to add new financial records on the subform. However, there is a purchase type field "cboType" which the user selects either Purchase Requisition, Payment Voucher and so forth, and two other fields "Commitments" and "Expenditures". I want to be able to hide the commitment and expenditure fields when the user is about to add a new financial record for a project. If purchase requisition is selected, then I want commitment to be displayed and if payment voucher is selected, I want Expenditures to be displayed. So far, I have the following code in my after update

Private Sub cboType_AfterUpdate()
Me.Requery
If Me.cboType= "Payment Voucher" Then
Me.txtCommitments.Visible = False
Me.txtExpenditure.Visible = True
Me.lblCom.Visible = False
Me.lblExp.Visible = True
Else
If Me.cboType = "Purchase Requisition" Then
Me.txtCommitments.Visible = True
Me.txtExpenditure.Visible = False
Me.lblCom.Visible = True
Me.lblExp.Visible = False

End If
End If
End Sub

However, nothing happens. I don't want to set fields to invisible because data already in these financial fields won't be displayed.

Help will be appreciated,
Thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom