Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Selection 2

Status
Not open for further replies.

OceanBlue

IS-IT--Management
Aug 15, 2002
54
0
0
US
I read a similar post what I didn't get a solution the to problem I am having.

If a certain selection is made from the combo box I need certain fields to be visible, else they should be not visible.

I have this code as:

Private Sub cboJobType_AfterUpdate()
txtApproval.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
txtPgsRejected.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
QAframe.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
End Sub

When I go to the next record or previous record or new record these fields are visible even though the combo selection isn't a case where they should be visible.

How do I fix this, where only when the combo selection is 7 or 8 that these fields be visible when I close the form and reopen it it should be visible only if the combo box has 7 or 8 or if I go to previous or next or new record the fields are visible only if the combo box is 7 or 8.

thanks
 
Hi
I think you will also need to add your code to the On Current event for the form.
 
Put the code in the Current event procedure of the form too.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Much appreciated! That seemed to do the trick.

When I am on a new record I get an error msg "Invalid use of Null" When I click on Debug it highlights

txtApproval.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
txtPgsRejected.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
QAframe.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
 
Maybe:
Code:
If Not IsNull(Me.JobType) Then
  txtApproval.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
  txtPgsRejected.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
  QAframe.Visible = (JobType.Value = 7 Or cboJobType.Value = 8)
Else
'Code for JobType has not been selected
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top