AfterUpdate Make Visible

C

Chip

Hey Everyone..

I have a tabbed form that has the following tabs...

CrimHx
PracticalExam
WrittenExam
RescueExam
ClassDef

each of thise tabs default setting for visible is false. The user
selects a course from a drop down list. That combo box has the
following options..

57 EFR
63 EMT
72 EMT-P
89 BVR
92 SVR

What I want is for various tabs to become visible depending on the
course that is choosen. I have tried every which way to make this
work, w/o using Macros. I can make it work with Macros, but in an
effort to increase efficiency, I've been trying to get it work in
VBA. I'm not sure where I'm going, but here is an example of what I
have..

Me.Text174 = Me.CourseCode.Column(1)
If Me.CourseCode = "57" Then
Me.ClassDef.Visible = -1
End If

This is simplified example. Typcially, if someone choose 57, a number
of tabs would be visible and a number would remain hidden. But if I
can get it to work with one tab, I'm confident I can remplicate it to
the others.. At one time, I had it working with an If, Then, ElseIf
statement that went through each and over possible combination. But
it stopped work, probably because I tinkered with someone I shouldnt
have...

Any help you can offer would be greatly appreciate..

chip
 
J

Jeff Boyce

Chip

I believe you need to make the 'page' of the tab control visible.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Chip

Well actually that is what I'm doing. At least I think it is.. The
tabs I need to make visible, have the Name field filled in like I
stated above. So my tabs are named ClassDef. The Caption for the tab
is Class Deficiency, but I thought that the space might be the root of
the problem.

Is that what you mean by 'page'. Or am I missing something...
 
J

Jeff Boyce

Try something like:

Me!YourTabControlName.Page(0).Visible= False

where "0" is the zero-based 'page number' of the tab.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Chip

No dice there either.. Here's what I have..

Private Sub CourseCode_AfterUpdate()
Me.Text174 = Me.CourseCode.Column(1)
If [Forms]![frmCourses]![CourseCode] = "57" Then
Me!WrittenExam.Page(5)!Visible = True
End If
End Sub

I've tried that line you gave me in the field On Change property too.
I've never seen !'s and .'s used in the same line. Always seen one or
the other. Not sure if that makes a difference or not.. The first
line above works ike a charms. Text174 is an undbound text box and
draws its value from the course title associated with the
coursecode.

In this example, coursecode 57 is a First Reponsder course I change
the ComboBox and it changes its value without issue. So its calling
 
J

Jeff Boyce

The "!" represents things created by you (like forms), while the "."
represent things Access has, like properties (.Visible) and methods
(.Requery).

If this were mine, I'd leave out the IF test and just see if the
Me!TabControl.Page(x).Visible = False works.

If I had to hazard a guess, the value of your [CourseCode] field is
something other that the text string "57". That could be because it is the
number 57 (not the same), or this might be related to the use of a lookup
datatype field in the table.

Do any of these ideas work for you?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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