By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

How do I hide columns on tab control subform?

P: n/a
Can any one help with a problem I have with a tab control form

I have a form with a two page tab control - page 1 being the main form. I
have a data sheet view subform on page 2.(linked by "Partype"
There is a part type combobox (from tblpartype) on page 1 and I wish to hide
columns on the data sheet depending on what part type is displayed on page
1.
I have tried this on the Partype after update event

If Me!partype = "Resistor 0.25W 5%" Then

Me![frm_subres_0_25W_spec].Form!wattage.ColumnHidden = False
Else
Me![frm_subres_0_25W_spec].Form![wattage].ColumnHidden = True

Can some one tell me why this doesn't work? When I cut and paste the part
type in the combo box and tab out of the box it works?
I want to be able to go to a record on page 1 and have page 2 display the
corresponding spec sheet automatically (By hiding non relevant columns)
without touching the partype combo box.

Can any one help?

Dave
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Are you saying that if you type the value into the partype box _and_
tab out of it it doesn't work, but if you cut and paste the value into
the partype box and tab out of it, it does work? When it doesn't work,
do you get an error message?

Bruce

Nov 13 '05 #2

P: n/a
Hi Bruce

When I go to an existing record were the part type is already selected it
doesn't work
It works fine for new records when I select a new part type from the combo
box.

I need the subform columns to hide/unhide according to what part is
displayed in existing records.

Any help you can provide would be very much appreciated

Dave
<br***@aristotle.net> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Are you saying that if you type the value into the partype box _and_
tab out of it it doesn't work, but if you cut and paste the value into
the partype box and tab out of it, it does work? When it doesn't work,
do you get an error message?

Bruce

Nov 13 '05 #3

P: n/a
Hi Dave,

The problem is that when you are pulling up an existing record the
AfterUpdate event does not fire (unless of course you change something
after you've pulled up the existing record).

What I would do in your situation is put the code you posted earlier in
a separate sub, e.g.

sub RefreshTab()

If Me!partype = "Resistor 0.25W 5%" Then
Me![frm_subres_0_25W_spec].For*m!wattage.ColumnHidden = False
Else
Me![frm_subres_0_25W_spec].For*m![wattage].ColumnHidden = True
End If

End Sub

And then I would call this new sub from both the AfterUpdate of the
partype combobox and the Current event of your form, e.g.

Sub partype_AfterUpdate()

Call RefreshTabs()

End Sub

Sub Form_Current()

Call RefreshTabs()

End Sub

The form's current event fires each time you recall an existing record.

Hope this helps,
Bruce

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.