hiding text boxes

S

srpatel

Hello, I am hoping for someone to help me on how to design my form in a
suitable way.

I have a form which has several text boxes, check boxes and combo
boxes. The form is purely for data entry.

I have currently created a tab control as there are about 10 text boxes
which will have information already populated in them when a reference
is entered.

The issue am facing is, I have a certain combo box with about 62
records to choose from. Our clients require the database to be designed
in a way that when say for example fencing is chosen from the combo
box, certain text boxes are hidden as they are not relevant for that
particular record.

All 62 records in the combo box have some similar text boxes that have
to be hidden or greyed out when entering data.

Any help would be greatful!
Thanks
SRP
 
D

Duncan Bachen

srpatel said:
Hello, I am hoping for someone to help me on how to design my form in a
suitable way.

I have a form which has several text boxes, check boxes and combo
boxes. The form is purely for data entry.

I have currently created a tab control as there are about 10 text boxes
which will have information already populated in them when a reference
is entered.

The issue am facing is, I have a certain combo box with about 62
records to choose from. Our clients require the database to be designed
in a way that when say for example fencing is chosen from the combo
box, certain text boxes are hidden as they are not relevant for that
particular record.

All 62 records in the combo box have some similar text boxes that have
to be hidden or greyed out when entering data.

Any help would be greatful!
Thanks
SRP

You want to use the After Update event of the combo box, to check the
value contained in the combobox, and then set the text field visibility
accordingly.

I'm not going to question the design/UI here, because even though it
sounds a bit strange, it's better to give you want you're asking for.

Example:

Private Sub cboMyComboBox_AfterUpdate()
Select Case cboMyComboBox
Case 1
txtMyTextbox1.visible = False
txtMyTextbox2.visible = False
txtMyTextbox3.visible = True
Case 2
txtMyTextbox1.visible = True
txtMyTextbox2.visible = False
txtMyTextbox3.visible = True
End Select
End Sub
 
S

srpatel

Hi Duncan,

I will give that a go and see how it works for my design.

Thanks
Shreekant
 
S

srpatel

Hi Duncan,

Ok I pretty new at access development, and just wanted abit more help.


For examples sake, say in my Combo Box I have; Ladder, Fence, Bucket,
Paint.

How do I make my code understand, that when Ladder is selected,
Textbox1.visible-false?

Am I correct in saying that I would have to have something identifying
what case is?
e.g Case 1 = Ladder,
Case 2 = Fence

Thanks
Shreekant
 
D

Duncan Bachen

srpatel said:
Hi Duncan,

Ok I pretty new at access development, and just wanted abit more help.


For examples sake, say in my Combo Box I have; Ladder, Fence, Bucket,
Paint.

How do I make my code understand, that when Ladder is selected,
Textbox1.visible-false?

Am I correct in saying that I would have to have something identifying
what case is?
e.g Case 1 = Ladder,
Case 2 = Fence

Thanks
Shreekant

I didn't know how you were storing the values in your combobox. What
column the combobox is bound to, and what value is displayed, aren't
always the same thing.

You could be displaying 'Ladder', but it could have a value of 1.

Take a look at the help for the Select Case.

If you had the string value bound, you would have the Select Case check
for the proper value. My earlier example assumed that you had it bound
to a numeric field, and I was just showing you the basic block code.

Select Case cboMyComboBox
Case "Ladder"
txtMyTextbox1.visible = False
txtMyTextbox2.visible = False
txtMyTextbox3.visible = True
Case "Fence"
txtMyTextbox1.visible = True
txtMyTextbox2.visible = False
txtMyTextbox3.visible = True
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top