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 / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Automatically format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
burnspaul@hotmail.co.uk - 19 Jan 2008 17:03 GMT
Hi, I want to enter a date into 1 field (a) and change font and colour
in another field (b) but still retain the data that is in field b. Can
you help. Thanks
Arvin Meyer [MVP] - 19 Jan 2008 17:26 GMT
Use the AfterUpdate event to change the font and color. Something like:

Sub txtControlA_AfterUpdate()
   If Len(Me.txtControlA & vbNullString) > 0 Then
       Me.txtControlB.FontBold = True
       Me.txtControlB.ForeColor = vbRed
   Else
       Me.txtControlB.FontBold = False
       Me.txtControlB.ForeColor = vbBlack
   End If
End If
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hi, I want to enter a date into 1 field (a) and change font and colour
> in another field (b) but still retain the data that is in field b. Can
> you help. Thanks
burnspaul@hotmail.co.uk - 19 Jan 2008 18:14 GMT
> Use the AfterUpdate event to change the font and color. Something like:
>
[quoted text clipped - 19 lines]
>
> - Show quoted text -

Sorry for being stupid but can't get this towork. Field 1 is called
Date, Field 2 is called Days, I would like to thank you for your help
Arvin Meyer [MVP] - 19 Jan 2008 20:03 GMT
I see why, the last End If should be End Sub, but you have another problem.
Date is a reserved word and should never be used as a field or control name.
I'll change it to try and make it work for you:

Sub DateField_AfterUpdate()
   If Len(Me.DateField & vbNullString) > 0 Then
       Me.Days.FontBold = True
       Me.Days.ForeColor = vbRed
   Else
       Me.Days.FontBold = False
       Me.Days.ForeColor = vbBlack
   End If
End Sub
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

On 19 Jan, 17:26, "Arvin Meyer [MVP]" <a...@m.com> wrote:
> Use the AfterUpdate event to change the font and color. Something like:
>
[quoted text clipped - 20 lines]
>
> - Show quoted text -

Sorry for being stupid but can't get this towork. Field 1 is called
Date, Field 2 is called Days, I would like to thank you for your help
burnspaul@hotmail.co.uk - 19 Jan 2008 20:31 GMT
> I see why, the last End If should be End Sub, but you have another problem.
> Date is a reserved word and should never be used as a field or control name.
[quoted text clipped - 46 lines]
>
> - Show quoted text -

Thank you - works great, have also changed field name from date to
date received. Thanks
Arvin Meyer [MVP] - 19 Jan 2008 21:30 GMT
One other tip: When possible, do no leave spaces in field names, If you do,
you'll always need to use square brackets around your field or control names
in code or SQL. Most database programmers either use an underscore or Camel
case, So instead of:

Date Received

use:

Date_Received

or:

DateReceived

I prefer Camel case because it's more intuitive to me, and I think it's more
readable.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> I see why, the last End If should be End Sub, but you have another
> problem.
[quoted text clipped - 49 lines]
>
> - Show quoted text -

Thank you - works great, have also changed field name from date to
date received. Thanks
Gabriel Alvim - 20 Jan 2008 15:24 GMT
Quero saber como que traz da i dos USA
> Hi, I want to enter a date into 1 field (a) and change font and colour
> in another field (b) but still retain the data that is in field b. Can
> you help. Thanks
 
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



©2009 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.