Selasa, 11 Oktober 2016

Re: [MS_AccessPros] Using a variable to refer to to a control

 

If the name of the control works, then try this:


frmActiveForm(ctlTabControl.Name).Style = 0


John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Oct 11, 2016, at 3:17 PM, Lance Gallant istari.6@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Hi all

I've written a short public function to control the formatting of a tab control, so that I may have a consistent look for tab controls across forms.

Public Function FormatTabControl(frmActiveForm As Form, ctlTabControl As TabControl)
frmActiveForm.ctlTabControl.Style = 0
frmActiveForm.ctlTabControl.BackColor = RGB(236, 236, 236)
frmActiveForm.ctlTabControl.BackStyle = 1
frmActiveForm.ctlTabControl.UseTheme = False
frmActiveForm.ctlTabControl.BorderStyle = 1
frmActiveForm.ctlTabControl.BorderColor = RGB(0, 0, 0)
End Function


When calling the function on form open I get a 2465 error

Replacing ctlTabControl with the name of the control it works. But I want the name of the Tab Control in a variable so I can reuse the code for any Tab Controls I want to affect. 

What is the correct way of referring to the Tab Control?



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar