dbTalk Databases Forums  

Changing the background Colour

comp.databases.ms-access comp.databases.ms-access


Discuss Changing the background Colour in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John
 
Posts: n/a

Default Changing the background Colour - 07-26-2009 , 03:45 PM






Hi,

I have a main form which has a sub form on the page, the sub form
contains two text boxes of totals (total A & total B), when a value is
in total B I want the main form's background to change colour to red.

I have tried this code in the form oncurrent event without success,

If Forms!frmTotal!txtTotalA = Value Then
Me.BackColour = VbRed
Else
'
End If

I would of thought I've got the syntax wrong on the vb program
somewhere on the code.

Can anyone help me on this please, Thanks.

Reply With Quote
  #2  
Old   
Keven Denen
 
Posts: n/a

Default Re: Changing the background Colour - 07-26-2009 , 03:49 PM






On Jul 26, 1:45*pm, John <david_l... (AT) hotmail (DOT) com> wrote:
Quote:
Hi,

I have a main form which has a sub form on the page, the sub form
contains two text boxes of totals (total A & total B), when a value is
in total B I want the main form's background to change colour to red.

I have tried this code in the form oncurrent event without success,

If Forms!frmTotal!txtTotalA = Value Then
Me.BackColour = VbRed
Else
'
End If

I would of thought I've got the syntax wrong on the vb program
somewhere on the code.

Can anyone help me on this please, Thanks.
The syntax you should use to refer to your subform is Forms!MainForm!
SubForm!Control.

Keven Denen

Reply With Quote
  #3  
Old   
fredg
 
Posts: n/a

Default Re: Changing the background Colour - 07-26-2009 , 04:44 PM



On Sun, 26 Jul 2009 12:45:26 -0700 (PDT), John wrote:

Quote:
Hi,

I have a main form which has a sub form on the page, the sub form
contains two text boxes of totals (total A & total B), when a value is
in total B I want the main form's background to change colour to red.

I have tried this code in the form oncurrent event without success,

If Forms!frmTotal!txtTotalA = Value Then
Me.BackColour = VbRed
Else
'
End If

I would of thought I've got the syntax wrong on the vb program
somewhere on the code.

Can anyone help me on this please, Thanks.
Let's see... the controls are in the sub form but it's the back color
of the Main form you wish to change.
Also [TotalB] is a calculated control.

Code the AfterUpdate event of each of the control's into which data is
*manually* entered that make up the value in [TotalB]:

If Me.[TotalB] >= 5 Then
Me.Parent.Section(0).BackColor = vbRed
Else
Me.Parent.Section(0).BackColor = vbWhite
End If

The above will change the back color of the Detail section of the main
form. If you wish to change the entire main form back color, you need
to add each section to the above code, i.e. Section(1), Section(2), as
needed, to the above code

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.