HELP WITH TAB CONTROL - HIDING FIELDS

A

amywolfie

Hi:

I have a tab control on a main form with 4 tab pages, each containing
a different sub-form. The users choose ST/COUNTY for 2 unbound combo
boxes on the main form, which triggers After Update.

When the user clicks to tab Page 1, I want to hide fields where values
are null:

Me.labVendorDetail1.Visible = Not IsNull(Me.VendorDetail1)
Me.VendorDetail1.Visible = Not (IsNull(Me.VendorDetail1))

Me.labVendorDetail2.Visible = Not IsNull(Me.VendorDetail2)
Me.VendorDetail2.Visible = Not (IsNull(Me.VendorDetail2))

What object/event should I use for this? I have tried the After
Update event on the County cbo box, On Change for the tab object, etc.

Thanks.
===
 
J

John W. Vinson

Hi:

I have a tab control on a main form with 4 tab pages, each containing
a different sub-form. The users choose ST/COUNTY for 2 unbound combo
boxes on the main form, which triggers After Update.

When the user clicks to tab Page 1, I want to hide fields where values
are null:

Me.labVendorDetail1.Visible = Not IsNull(Me.VendorDetail1)
Me.VendorDetail1.Visible = Not (IsNull(Me.VendorDetail1))

Me.labVendorDetail2.Visible = Not IsNull(Me.VendorDetail2)
Me.VendorDetail2.Visible = Not (IsNull(Me.VendorDetail2))

What object/event should I use for this? I have tried the After
Update event on the County cbo box, On Change for the tab object, etc.

Thanks.
===

The tab object's Change Event should work, if indeed the triggering event is
the selection of the tab page. I'm curious why you would want to hide a
control which is already blank though! What are you in fact seeing? If you put
a breakpoint in the Change event code, is it executing when you expect, and
are the vendor values what you expect?

Do note that if VendorDetail1 and VendorDetail2 are controls *on a Subform*
then they do not exist on the mainform; you'll need to reference them via the
name of the Subform Control (which might or might not be the same as the name
of the form within that control):

Me!subformname.Form!VendorDetail1.Visible = ...
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
A

amywolfie

John:

Your solution did work, but with this caveat:

Every time I click on a tab, I get this message:

Error 3362 Recordset Not updatable.

The user needs to modify the data.

Thanks!
====
 
J

John W. Vinson

John:

Your solution did work, but with this caveat:

Every time I click on a tab, I get this message:

Error 3362 Recordset Not updatable.

The user needs to modify the data.

Please post your actual code and the Recordsource of the form. Making a
textbox invisible should not have anything to do with updating a recordset.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
A

amywolfie

Sure.

Subform name = subfrmVendorDetail_MANILA [the name assigned]
The full subform name is 2subfrmVendorDetail_MANILA

The control names are not the field names for VendorDetail1, etc.

Here is sample of my code:


For the tab control, On Change Event:

================

Private Sub TabCtl1_Change()


On Error GoTo Error_Handler:

'Me!subformname.Form!VendorDetail1.Visible = ...

Me!subfrmVendorDetail_MANILA.Form!labVendorDetail1.Visible = Not
IsNull(Me!subfrmVendorDetail_MANILA.Form!VendorDetail1)
Me!subfrmVendorDetail_MANILA.Form!VendorDetail1.Visible = Not
(IsNull(Me!subfrmVendorDetail_MANILA.Form!VendorDetail1))

Me!subfrmVendorDetail_MANILA.Form!labVendorDetail2.Visible = Not
IsNull(Me!subfrmVendorDetail_MANILA.Form!VendorDetail2)
Me!subfrmVendorDetail_MANILA.Form!VendorDetail1.Visible = Not
(IsNull(Me!subfrmVendorDetail_MANILA.Form!VendorDetail2))

Exit Sub

Error_Handler:
MsgBox Err.Number & " " & Err.Description


End Sub

========
 
A

amywolfie

Something else I should mention:

The Data Source of the subform is a linked Excel spreadsheet, set to
Shared.

Thanks.
====
 
J

John W. Vinson

A

amywolfie

Ah ha!

Thanks for the tip. I'll make an Access table out of the spreadsheet.

Amy
===
 

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