Reference to Tab Control in VBA (Should be easy)

I'm trying to disable all textboxes and comboboxes for people whose access is not "Admin". For some reason this also disables my Tab Control and I can't figure out how to make it so that non-admins can still look at the different tabs

This is my code (I don't know how to post it fancy)

Private Sub Form_Load()
Dim rs As dao.Recordset
Dim permission As String
Dim ctlTmp As Control
Set rs = CurrentDb.OpenRecordset("Select * FROM qry_UserGroup")
permission = rs!UserPermissions
If permission = "Admin" Then
Forms("frm_EmployeeInformation").AllowEdits = True
Forms("frm_EmployeeInformation").AllowEdits = False
On Error Resume Next
For Each ctlTmp In Forms("frm_EmployeeInformation").Controls
If TypeOf ctlTmp Is ComboBox Or TypeOf ctlTmp Is TextBox Then
ctlTmp.Enabled = False
End If
Next ctlTmp
End If
Set rs = Nothing

Sponsored Links:

Related Topics

Set Focus to specific tab on a Tab Control
Is it possible to set the focus on a specific tab on a tab control via VBA? My goal is to set the focus to the tab when the form opens.

Different iterations of Me.TabCtl0.Pages.Page1.SetFocus doesn't work. I am unable to find the correct syntax to reference the tab.

Reference to Tab Control in VBA
I'm trying to disable textboxes and comboboxes for people whose access is not "Admin". For some reason this also disables my Tab Control and I can't figure out how to make it so that non-admins can still look at the different tabs...

Reference a field on a tab control
I am having trouble with a tab control. I am trying to reference a text field on a subform of a tab control using a query.

Main Form: frmSwitchBoard
Tab Control: TabCtl0
Sheet Name: SearchClaims
SubForm: frmClaimSearch
Text Field: Text54

I am trying to reference that field in a query, but I am trying a hard time getting it to find the field.

This is what I have so far:


I tried going through other post and looked at the following link,, but wasn't able to figure it out

Refer to Control within a Tab Control in VBA #2
I would like to add a reply to thread 27700 but when I go to it, I am logged out

I have a Tab Control on my form and have recently copy-pasted my controls on to it - however my VBA no longer works. From what I've read, each control (regardless of which tab its on) needs a unique name - check, and therefore can be referred to as if it were directly on the form and there was no Tab control.

txtDOB is the text field to store - you guessed it, a Date Of Birth.
lblAGE is a label to show "30 years, 3 months" etc, which is done by VBA within OnCurrent so it refreshes automatically as you move from person to person.

Now a simple bit of code like. lblAge.Caption = "test" creates runtime error 424; Object required.

It works directly on the form outside the realms of the Tab, but not on a Tab.

Form is called frmMembers
Tab Control called TabCtl1
Page Name called Page1

Access 2010 - Navigation Forms (how to reference a control)
I love the new navigation form functionality in Access 2010, however am having problems referencing a control within the subforms.

I have 10 navigation buttons on the parent form, each with a subform. I desparately need to be able to reference controls within each subform, however am struggling with the syntax.

I have tried the following code:
which works beautifully for the first subform (ie. Tab Index = 0)

However, I am stumped as how to reference a control on any of the other 9 subforms (ie Tab Index - 1-8) as the aforementioned syntax doesn't work for any of them but the first (ie Tab Index

Catching Tab Control Page Changes with VBA
I currently have a form which contains a tab control (which has six different pages). I am trying to find out how I can catch a page change on the tab control in order to trigger certain

Refer to Tab Control Objects in VBA
You can use a tab control to present several pages of information about a single form. A tab control is useful when your form contains information that can be sorted into two or more categories. Learn how to use tab controls on a form.

Scrolling a tab page
Is it possible to have scrolling capability within a tab page on a form?

Currently I have a form with tab control. There are 7 tabs and the 7th tab has a long list of check boxes that wont fit inside the area I set aside for the tab control box. When I place the check boxes into the tab page, the page automatically re-sizes to contain all the new check-boxes. I am not able to re-size the tab page. Are there any settings that will allow me to re-size the tab page to contain all the check-boxes and scroll to view them all?

It seems like it should be easy and straightforward. right?

Access control in 2nd level subform using tab control
I tried a few google hits in regards to this but it doesn't seem to be working. I have 3 forms (frminstution -> invoice -> frminvoicelinedetail (this subform is on a tab control called pgShipping)).

I am trying to reference an object (called OrderLink) on the InvoiceLineDetail in a query.

These were attempts at trying to go about it. All I get is a parameter box, which there should be none (the forum is open so it isn't that

How to reference a control on a subform in a tab
I have a Mainform called Mainfrm and on it is a tab called Tabctl1.

On this tab is a page called pg1 and on the tab is a subform called form2.

This form2 has a control I'd like to make enabled when a button is pressed from MainForm.

I've been trying to use

Main Tab Control with Child
I'm using Access 2003. I have a form with a tab control. I want to have another tab control within one of the page of the main tab control. So when you go to a certain tab, I'll see 3 sub pages. I can't seem to drag a new tab control onto a existing page of the main tab

Establish tab order between objects in tab control pages
In Access 2003/XP/2000/97, I have a form with a main tab box (created with a tab control) with four tabs on it and each tab has a number of text boxes on it. I have indexed these tabs so when the user tabs across, it goes from one tab page to another. However when it reaches the last text box on a particular tab instead of going to the next tab, it goes to the next record.

add subform to TAB control?
I have created a subform on my main form and it works fine.

I now decided I want to add this subform to a TAB control.

I followed the instructions that are identical from numerous sites, postings on the internet. However the subform keeps showing up for both of the 2 default tab pages.

Is there a trick to dropping the subform onto the TAB control so that it is associated with only one TAB page and is not visible in all TAB pages

Go to A Page on A Tab Control
I would like to go to a page on a tab control from the DoCmd.OpenForm command.

How do we do that again? Or what vba do I use to open it>

The Tab Control has the default name tabctl0
The form it is on is called frm_MyLists

I tried

Docmd.openform "MyLists", acNormal,,tabctl0.value = 5

but no go.

Anybody know how to get there from here

Access 2010 Tab Control Problem
Using Access 2010 I have created a form using tab control. I renamed each tab using caption property and added existing fields to each tab. The first tab shows the fields on both the first tab and the 2nd tab why?

How to stop Tab Control on few control
How to stop Tab Control on few control in my form. I have few textboxes and listbox I do not want users to be able to hit tab and wheneve they hit tab, it skips those controls.

Tab Control
is it possible to change a controls 'Tab Stop' setting through code.

1.cboCode - Tab index 0
2.txtProd - Tab index 1
3.txtQty - Tab index 2

When the form opens a new record controls 1 & 3 are enabled and tab stop is set to yes, control 2 is locked and tabstop is set to No.

If the users enters a cboCode then when they tab across the focus goes to the txtqty control.

However if they do not enter a code and hit tab I want the focus to go to txtProd to be the next control

Is this possible? and I am assuming that as the tab indexes are there enabling this one won't bugger up the order

Anchor a field on a tab control or lock it to a specific tab
I have placed a 4 page tab control on my main form and have noticed that the fields that I place on the tab mirrors onto all other tabs. Is there a way to anchor a field on a tab control or lock it to a specific tab??

Tab controls
I was wondering if its possible to do the following: scenario is 2 checkboxes on a sub-form which sits on a tab control. If both boxes are unchecked, the tab control is coloured red; if one is checked without the other the the tab is amber, and if both are checked then the tab is coloured green

Selecting where another record doesn't contain a similar reference
I'm trying to think of a purely SQL way of selecting records from a single table for a listbox where the data for the project's reference cannot be like another. To illustrate,the table might have three records containing these values in the reference field like this:


and the output of the query should be:


If there is a B-type reference corresponding to the A-type reference, then the original A-type reference cannot be selected. But if there is no such B-type reference, then the A-type reference IS selected.

This result would be easy enough to achieve with some VBA behind it but I'm ideally wanting it to be purely SQL.