Need help with this please.

B

Bob H

I have a table with 11 different types of tools , and I want a form with
a combo box or similar to select the tool type from another table. Then
when that specific tool type is shown, I just want the required feilds
for that tool to show, and hide the other feilds which are not relevant.

The table has 12 feilds for 11 differnt types of tools and not all
feilds are required for all tools, so some feilds are Null.

Is there a way to do what I want please?

Thanks
 
D

Douglas J. Steele

Put code in the combo box's AfterUpdate event to handle it.

Private Sub cboTool_AfterUpdate

Select Case Me.cboTool
Case "Tool1"
Me.Control1.Visible = False
Me.Control2.Visible = True
Me.Control3.Visible = False
Me.Control4.Visible = True
Case "Tool2", "Tool3"
Me.Control1.Visible = True
Me.Control2.Visible = True
Me.Control3.Visible = False
Me.Control4.Visible = True
Case "Tool4"
Me.Control1.Visible = False
Me.Control2.Visible = True
Me.Control3.Visible = True
Me.Control4.Visible = True
' etc.
End Select

End Sub
 
J

Jeff Boyce

Already responded to in a separate newsgroup.

Please don't post the same or closely related items separately to separate
newsgroups. Not only does that make you have to remember and look in all
the places you posted, but the volunteers in these newsgroups end up
duplicating each other's efforts.

If there is a strong need to post to more than one newsgroup (this is rare),
please use the To:/Newsgroups: field to add the 'groups. This way, a
response in one shows up in the other(s).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

David W. Fenton

Put code in the combo box's AfterUpdate event to handle it.

Private Sub cboTool_AfterUpdate

Select Case Me.cboTool
Case "Tool1"
Me.Control1.Visible = False
Me.Control2.Visible = True
Me.Control3.Visible = False
Me.Control4.Visible = True
Case "Tool2", "Tool3"
Me.Control1.Visible = True
Me.Control2.Visible = True
Me.Control3.Visible = False
Me.Control4.Visible = True
Case "Tool4"
Me.Control1.Visible = False
Me.Control2.Visible = True
Me.Control3.Visible = True
Me.Control4.Visible = True
' etc.
End Select

End Sub

I suspect you just made that up, as it's not at all logical, since
Control2 and Control4 are always visible under all cases.

I think it's better if sample code not have inconsistencies like
that, as someone could easily get hung up trying to understand why
you're setting something to the exact same value no matter what
choice is made.
 
D

Douglas J. Steele

David W. Fenton said:
I suspect you just made that up, as it's not at all logical, since
Control2 and Control4 are always visible under all cases.

I think it's better if sample code not have inconsistencies like
that, as someone could easily get hung up trying to understand why
you're setting something to the exact same value no matter what
choice is made.

Of course I just made it up, since the OP gave no details.

And the 'etc was intended to indicate that additional cases would be there
(the OP did say 11 different tools, and I only showed 4)
 

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