Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2006, 07:51 AM
Registered User
 
Join Date: Sep 2006
Location: Saltillo, Coahuila, Mexico.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Candyd
Default textbox color


Hi I am new in access and I have a lot of questions. I have a form where i put the information of one record that I need, and in the same form i have a subform (same table than the first form) where i have the same information but with all the records of a specific date, i control hours in the most of the fields and what i want to do in all records is that if for example: hour2 > hour1 backcolor the hour2 textbox, until know I can do this but the problem is that if i have 20 records and i put a date in the fist record will put the same color for all the records although the hour1 is > than hour2.

Also i want to know if that color can be reflected in a report?
Could you please help me with this?

I really appreciate all the help you all can give me.

Regards

Reply With Quote
  #2 (permalink)  
Old September 29th, 2006, 10:57 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I am not so sure about the subform, but I would open it by itself in design view, and then use Format > Conditional Formatting to see if that works.

You can use conditional formatting in the report as well. In the report, you can also go to the Detail section's On Format event and add code like:

Dim iHour1 As Integer
Dim iHour2 As Integer

iHour1 = Me.Hour1
iHour2 = Me.Hour2

If iHour2 > iHour1 Then
   Me.Hour2.BackColor = vbRed
End If

for example...

Look up conditional formatting in Help.

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old September 29th, 2006, 11:32 AM
Registered User
 
Join Date: Sep 2006
Location: Saltillo, Coahuila, Mexico.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Candyd
Default

Hi, Thanks for your help,

I did try to do what you wrote about the report but at the moment that i run it, show a compile error:
Method or data member not found (and highlight .backcolor =)
Do you know what i am doing wrong???

Also I think that i could use a For cicle to get the color in all records but I do not know if something like "FOR i=1 to end of file" could work.

Thanks again for your help.

Dulce :)

Reply With Quote
  #4 (permalink)  
Old September 29th, 2006, 11:37 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

.ForeColor will set the font color. I am looking for the back color... hang on...

mmcdonal
Reply With Quote
  #5 (permalink)  
Old September 29th, 2006, 11:39 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Okay, I used this code and it worked, but I had to set the Back Style to Normal using the text box's Properties dialog box:

Me.Text9.BackColor = vbRed

mmcdonal
Reply With Quote
  #6 (permalink)  
Old September 29th, 2006, 12:14 PM
Registered User
 
Join Date: Sep 2006
Location: Saltillo, Coahuila, Mexico.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Candyd
Default

Same thing, when i write me.h2. (shows value)it does not have the options as in other ocations to write or choose backcolor. Do you think that I need a especific Reference to be abble to do this???

Thanks

Reply With Quote
  #7 (permalink)  
Old October 18th, 2006, 02:16 PM
Authorized User
 
Join Date: Oct 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to DeMoNN
Default

to access a subform...

[subformBOXname].Form![textBoxName].BackColor = vbRed


note: [subformBOXname] is the name of THE BOX or CONTAINER where the subform is located, not the subform itself

its the name you typed when you added the subform to your form

to find it, open the proporties window

click on the subform ONCE
if you click it once the whole box will be selected and you will see RESIZING abilities

if you click it twice, a dot 5px X 5px in the top left corner of the subform will turn black

you dont want that, you want the other one

I was here but now I'm gone.
I leave this messege to be carried on.
Whoever knew me, knew me well.
Whoever didn't, go to hell.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointing cursor from one textbox to other textbox lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 2 August 2nd, 2007 03:41 PM
not enable textbox or combobox font color SabinoFonseca VB.NET 2002/2003 Basics 1 March 15th, 2007 01:52 PM
TextBox color different Gibs_poovath General .NET 4 December 7th, 2004 03:06 AM
color acko ASP.NET 1.x and 2.0 Application Design 7 January 1st, 2004 12:41 AM
Masked TextBox & formatting TextBox melvik C# 1 September 22nd, 2003 11:01 AM



All times are GMT -4. The time now is 08:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.