473,394 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

color subform tab when text boxes are filled

Hi,
I am trying to color a subform tab blue or red when 2 of its text boxes are
not null. Here is my code that I tried but it's not working:

If Forms![Centers of Influence subform].First Is Not Null And Forms![Centers
of Influence subform].Last Is Not Null Then
Forms![Centers of Influence subform].Page4781 = RGB(0, 0, 255) 'blue
Else
Forms![Centers of Influence subform].Page4781 = RGB(0, 0, 0) 'black

End If

can anyone tell me what's wrong with my code?
First and Last are the name of the text boxes in the subform.

Thanks in advance
May 18 '07 #1
9 2041
puppydogbuddy
1,923 Expert 1GB
Hi,
Here is my code that I tried but it's not working:

If Forms![Centers of Influence subform].First Is Not Null And Forms![Centers of Influence subform].Last Is Not Null Then
Forms![Centers of Influence subform].Page4781= RGB(0, 0, 255) 'blue
Else
Forms![Centers of Influence subform].Page4781 = RGB(0, 0, 0) 'black
End If

You need to provide some more details on what "not working" means in this context.....compile error, runtime error, any error messages? Also is this code running from the subform or from the Main Form?

In looking at your code (pending further information), it appears to be a problem with your reference syntax. For example if your code is running from your MainForm, your reference should be like this:

Forms![YourMainForm]![Centers of Influence subform].Form!First

If it is running from your subform, your code syntax should look something like this:
Me!First = .........
May 18 '07 #2
Thanks for your reply.
The code is running from the Main Form (On Open) so I changed the code to look like this:

If Forms![Client Maintenance Center Search]![Centers of Influance subform].Form!First Is Not Null And Forms![Client Maintenance Center Search]![Centers of Influance subform].Form!Last Is Not Null Then
Forms![Client Maintenance Center Search]![Centers of Influance subform].Form!Page4781 = RGB(0, 0, 255) 'blue
Else
Forms![Client Maintenance Center Search]![Centers of Influance subform].Form!Page4781 = RGB(0, 0, 0) 'black

End If
I get the following error: " Object required"
May 18 '07 #3
sorry the complete error message is:

Run time error '424'
Object required

Thanks
May 18 '07 #4
puppydogbuddy
1,923 Expert 1GB
sorry the complete error message is:

Run time error '424'
Object required

Thanks
You did not me which line was highlighted, but I think it would be the line referencing the the tab page because the tab control is not part of the form/subform reference.....it has its own reference as shown:

Genericreference>>>>TabCtl1.Pages.Item(0) >>item is page index
Your reference???>>>>TabCtl4781.Pages.Item(0) >>index for first tab page
May 18 '07 #5
Yes the first line is the one highlighted. I am not following on the next lines, how do I include them in my code?

Genericreference>>>>TabCtl1.Pages.Item(0) >>item is page index
Your reference???>>>>TabCtl4781.Pages.Item(0) >>index for first tab page

thanks
May 18 '07 #6
puppydogbuddy
1,923 Expert 1GB
Yes the first line is the one highlighted. I am not following on the next lines, how do I include them in my code?
thanks
The first line looks ok. In order to check it out, I need to double check the following:
Main Form Name?
Subform Control Name?
Source Object Name?
Is First what is shown for the name property of the textbox?

The tab page is referenced by tab control name and page index, so when you try to set the color of the first tab page, you should reference as:
Page4781.Pages.Item(0).BackColor = ..... >>>assuming that the tab control name is Page4781.
May 18 '07 #7
puppydogbuddy
1,923 Expert 1GB
I did some research and found out that the color properties are not available to the tab control and tabs. The good new is that you can accomplish what you want using a trick. The following link is an excellent "How To" tutorial with code examples and a downloadable working demo file based on the tutorial. Enjoy!

http://www.fontstuff.com/access/acctut12.htm
May 18 '07 #8
Thank you so much for all your help.
May 21 '07 #9
puppydogbuddy
1,923 Expert 1GB
Thank you so much for all your help.
You are welcome. I'm glad I could help.
May 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: chris vettese | last post by:
I've been having trouble with this for a long time. I have a form that has many subforms. In the subforms I have unbound text boxes in the footer that sum a field. I want to Display this sum on...
4
by: vulcaned | last post by:
Hi All, Hopefully I explain this well........ In Access97 I have a form which has a tab control on it, each tab has a sub-form which is bound to its appropriate table(I'll call them 'Detail'...
1
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the...
1
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. ...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.