Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / May 2008

Tip: Looking for answers? Try searching our database.

Highlight textbox based on date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NeoFax - 21 May 2008 14:49 GMT
I have a crosstab report that has the days of the month across the top
as "column headings" and workcenters as rows with accomplished hours
as the data.  I would like to highlight todays column each day.  Here
is what my report looks like:

Helo(Group header)
Station   W/C     1  2  3  4  5  6  7  8  9  10  11  12  13  14
15  ....  31  Total
1STA     Elec     x  x   -  -  x  x  x  x  x   -    -     x    x
x    x...

What I would like is if Day(Now()) = 15 then column 15 would
highlight.  However, I really do not want to write 31
If..Then..ElseIf..Else code.  My data textboxes follow a standard of
txt15 (txt plus the date number).  Is there a way to basically state
like Day(now()) = stgTextbox.  Me.stgTextbox.backcolor = rgb(255,0,0)?
John Spencer - 21 May 2008 18:09 GMT
Something like the following UNTESTED snippet where your controls are named
Txt1 to Txt31.

For I = 1 to 31
  IF Day(Date()) = I Then
     Me("Txt" & I).BackColor = rgb(255,0,0)
  ELSE
     Me("Txt" & I).BackColor = vbwhite
  END IF
Next

Or even simpler in your case
   Me("Txt" & Day(Date()).BackColor = rgb(255,0,0)

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

> I have a crosstab report that has the days of the month across the top
> as "column headings" and workcenters as rows with accomplished hours
[quoted text clipped - 12 lines]
> txt15 (txt plus the date number).  Is there a way to basically state
> like Day(now()) = stgTextbox.  Me.stgTextbox.backcolor = rgb(255,0,0)?
NeoFax - 27 May 2008 15:45 GMT
> Something like the following UNTESTED snippet where your controls are named
> Txt1 to Txt31.
[quoted text clipped - 34 lines]
>
> - Show quoted text -

Thanks!  It worked great!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.