A Simple Peice Of Code Wont Work, Please Tell Me Why.

sirantonycartwr

Registered User.
Local time
Yesterday, 19:57
Joined
Dec 10, 2006
Messages
45
Hello, i have this simple peice of code, it just wont work, i have no idea why...
its to set a tab visible or invisible, ive never needed to use the isvisible method before so i think ive done something wrong, but ive looked at how to use it and it seems right.

I get error code: 2455, invalid reference.


Code:
Private Sub btnAddRooms_Click()
If Forms!frmRoomYearTariffs!Rooms.IsVisible Then
    Forms!frmRoomYearTariffs!Rooms.Visible = False
Else
    Forms!frmRoomYearTariffs!Rooms.Visible = True
End If
End Sub

Does anyone know whats wrong?
Ant...
 
You're referring to the tab incorrectly. If I remember correctly (I use it at work but I'm at home at the moment) It would be:

Forms!frmRoomYearTariffs.YourTabControlName.Pages("Rooms").Visible = False
 
no. still doesnt work, its saying that this line is incorrect:

If Forms!frmRoomYearTariffs!Rooms.IsVisible Then

Ant...
 
I was assuming you'd figure out that I was talking about each of the places you had that code. Change ALL of the ones that had your original code to the reference I gave. :rolleyes: Not the exact code, but the
Code:
If Forms!frmRoomYearTariffs!Rooms.IsVisible
part to this:
Code:
Forms!frmRoomYearTariffs.YourTabControlName.Pages( "Rooms").Visible
 
ha ha, youde be right to think that too!

i typed:

If Forms!frmRoomYearTariffs.tab.Pages("Rooms").Visible Then

instead of:

If Forms!frmRoomYearTariffs.tabs.Pages("Rooms").Visible Then

Thanks, Ant...
 

Users who are viewing this thread

Back
Top Bottom