Changing the properties of controls at runtime

ande-s

Registered User.
Local time
Today, 11:15
Joined
Oct 5, 2011
Messages
28
Hi,

I'm having trouble with what I thought was a very basic operation with one of my forms.

Because I have had to revert back to Access 2007 from 2010 I have lost the ability to use the shiney new Navigation bar feature, so am having to do this manually via a few command buttons.

I have verious tabbed controls on my page, but I cannot seem to show/hide them from the command buttons using the .visible property.

This would be the way in VB but am I wrongly assuming that VBA works the same? Or doesn't work in my care!

Thanks
 
Hard to tell. I have not installed the Mindreading and Remote Viewing Module, so you'll have to provide some code , say what you want it to do and say what it actually does (or does not). Or wait for someone with the MRVM :D
 
I just have this code for the event "On Click" for the command button:

Private Sub cmdEditRecords_Click()

tabComponents.Visible = True

End Sub
 
I use MRVM but I don't seem to need it for this thread :D

@ande-s: If you're talking about hiding the Tab control itself, then you do:
Code:
Me.[COLOR=red][B]TabControlName[/B][/COLOR].Visible = False
If you're talking about hiding individual pages (or tabs) within the Tab control, then you refer to it using its Page Index:
Code:
Me.[B][COLOR=#ff0000]TabControlName[/COLOR][/B].Pages([B][COLOR=red]0[/COLOR][/B]).Visible = False
 
Is the command button on the same form as the tab? For it works fine for me in A2007.


 
Yes it's on the same form. it's a modal form trying to hide the tab control.

The code seems fine, but it will just not execute when I click the button!
 
When you refer to a control, be explicit. Use the Me. construct.

Are you sure you didn't rename the control? Click on the elipsis button of the On Click event of that control and see whether it leads you to that block of code.
 
It is using the me and it still won't work.

The correct command button is calling the correct piece of code.:confused:
 
Put a msgbox in your code to test whether it pops-up when you click the button.
 
Does any VBA code run? Code does not run in 2007/2010 unless your database resides in a folder that has been declared a “trusted” location, and perhaps you haven't done this on the particular machine you're currently using.

But keep in mind, while many Functions and Properties and most Code works the same in VB and VBA for Access, this is not always true! To make matters even worse, the names of these things are often identical although they behave differently!

Linq ;0)>
 
The message box doesn't launch either. There is no other VBA code at all in the database so far.

How do I go about setting the DB to a trusted location?
 
Problem solved, it was the trusted location issue
 

Users who are viewing this thread

Back
Top Bottom