General discussion

Locked

Access Check Box Visibility

By chainsawz ·
I have a table, which contains a combo box called 'Complaint Type' that allows the user to select 'Claims Issues' or 'Contract Issues'. This table also contains yes/no fields that relate to the complaint type chosen. A few are CL-Claim Denied, CL-Claim Paid, CT-Contract Terminated, and CT-New Contract. I built a form, and I am trying to write code that will only display the yes/no check boxes that are associated with the complaint type chosen. For example, if the user selects the complaint type 'Claims Issues', I want only the yes/no check boxes CL-Claim Denied, and CL-Claim Paid to appear on the form. If the user selects 'Contract Issues', I only want to see 'CT-Contract Terminated' and 'CT-New Contract' on the form.

I know my sorry attempt at writing the code is missing quite a bit?.can anyone pleeeease help me with this? Thanks!!!

Private Sub Complaint_Type_Category_Codes_Click()
If Me.Complaint_Type_Category_Codes = "Claims Issues" Then
CL-Claim Denied.Visible = True
CL-Claim Paid.Visible = True
If Me.Complaint_Type_Category_Codes = "Contract Issues" Then
CT-Contract Terminated.Visible = True
CT-New Contract.Visible = True
Else
CL-Claim Denied.Visible = False
CL-Claim Paid.Visible = False
CT-Contract Terminated.Visible = False
CT-New Contract.Visible = False
End If
End If
End Sub

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Access Check Box Visibility

by Don Christner In reply to Access Check Box Visibili ...

You have your IF statements nested wrong. The way it is written, it can not get to the second IF statement, nor the ELSE statement. I think it would be easier for you to use SELECT CASE. Make a CASE statement for "claims issues" and "contract issues" and within each CASE, show or hide the choices you want.

Don

Collapse -

Access Check Box Visibility

by chainsawz In reply to Access Check Box Visibili ...

You guys are awesome! I increased the points on this since both the methods worked for me. Utimately, I used the SELECT CASE due to the number of cases I actually had. Thanks for saving me!!

Collapse -

Access Check Box Visibility

by Glen_McLeod In reply to Access Check Box Visibili ...

Here's your code cleaned up a bit:

If Me.Complaint_Type_Category_Codes = "Claims Issues" Then

CL-Claim Denied.Visible = True
CL-Claim Paid.Visible = True

ElseIf Me.Complaint_Type_Category_Codes = "Contract Issues" Then

CT-Contract Terminated.Visible = True
CT-New Contract.Visible = True

Else

CL-Claim Denied.Visible = False
CL-Claim Paid.Visible = False
CT-Contract Terminated.Visible = False
CT-New Contract.Visible = False

End If

I really try to stay awayfrom lots of 'ElseIf' clauses, but with only 3 cases here, it's not too bad. The above answer using 'Select Case' will work too, but here's the code for you to copy and paste.

Glen

Collapse -

Access Check Box Visibility

by chainsawz In reply to Access Check Box Visibili ...

You guys are awesome! I increased the points on this since both the methods worked for me. Utimately, I used the SELECT CASE due to the number of cases I actually had. Thanks for saving me!!

Collapse -

Access Check Box Visibility

by chainsawz In reply to Access Check Box Visibili ...

Point value changed by question poster.

Collapse -

Access Check Box Visibility

by chainsawz In reply to Access Check Box Visibili ...

This question was closed by the author

Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums