Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Changing color of a textbox in a subform

Geek News

Changing color of a textbox in a subform
DontKnow 12/2/2008 10:37:01 PM
Hi Guys,

I am trying to change the color of a textbox in a subform, but so far with
not much luck.
The code that I am currently using is:

Me.textboxname.backcolor = 255 'To change the color of the textbox to red
Me.textboxname. value = "changeme"

The 2nd line of cocde works but unfortunately I cannot get the background
color to change. I don't know what I am doing wrong.

I have also tried:
Me.textboxname.backcolor = rgb(255,0,0)
and still no luck!!

I am using the textbox in a subform and datasheet view ( i believe that you
can change the backcolor of a textbox in a subform and datasheet view during
runtime??)

Any suggestions??

Cheers,
RE: Changing color of a textbox in a subform
MikeJohnB 12/2/2008 11:58:09 PM
Hi, if you simply want Red one way is
Me.TextboxName.BackColor = vbRed

I am not sure why 255 is not working for you, will try it.

I hope this has answered your question?
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


"DontKnow" wrote:

[Quoted Text]
> Hi Guys,
>
> I am trying to change the color of a textbox in a subform, but so far with
> not much luck.
> The code that I am currently using is:
>
> Me.textboxname.backcolor = 255 'To change the color of the textbox to red
> Me.textboxname. value = "changeme"
>
> The 2nd line of cocde works but unfortunately I cannot get the background
> color to change. I don't know what I am doing wrong.
>
> I have also tried:
> Me.textboxname.backcolor = rgb(255,0,0)
> and still no luck!!
>
> I am using the textbox in a subform and datasheet view ( i believe that you
> can change the backcolor of a textbox in a subform and datasheet view during
> runtime??)
>
> Any suggestions??
>
> Cheers,
RE: Changing color of a textbox in a subform
MikeJohnB 12/3/2008 12:01:01 AM
I have confirmed that Me.txtBoxName.BackColor = 255 works. So where are
you placing the code in which control and on which event?

Regards
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


"MikeJohnB" wrote:

[Quoted Text]
> Hi, if you simply want Red one way is
> Me.TextboxName.BackColor = vbRed
>
> I am not sure why 255 is not working for you, will try it.
>
> I hope this has answered your question?
> --
> Advice to Posters.
> Check your post for replies or request for more information.
> Consider providing some feed back to the response you have recieved.
> Kindest Regards Mike B
>
>
> "DontKnow" wrote:
>
> > Hi Guys,
> >
> > I am trying to change the color of a textbox in a subform, but so far with
> > not much luck.
> > The code that I am currently using is:
> >
> > Me.textboxname.backcolor = 255 'To change the color of the textbox to red
> > Me.textboxname. value = "changeme"
> >
> > The 2nd line of cocde works but unfortunately I cannot get the background
> > color to change. I don't know what I am doing wrong.
> >
> > I have also tried:
> > Me.textboxname.backcolor = rgb(255,0,0)
> > and still no luck!!
> >
> > I am using the textbox in a subform and datasheet view ( i believe that you
> > can change the backcolor of a textbox in a subform and datasheet view during
> > runtime??)
> >
> > Any suggestions??
> >
> > Cheers,
Re: Changing color of a textbox in a subform
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/3/2008 12:20:33 AM
On Tue, 2 Dec 2008 14:37:01 -0800, DontKnow
<DontKnow[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>I have also tried:
>Me.textboxname.backcolor = rgb(255,0,0)
>and still no luck!!
>
>I am using the textbox in a subform and datasheet view ( i believe that you
>can change the backcolor of a textbox in a subform and datasheet view during
>runtime??)

Not in a datasheet to my knowledge - you can do so in a Continuous Form.

Another option (which I believe works with datasheets too) is to use Format...
Conditional Formatting from the menu.
--

John W. Vinson [MVP]
Re: Changing color of a textbox in a subform
DontKnow 12/3/2008 12:39:01 AM
Hi Guys,

yes I am trying to update the textbox color in a datasheet view!!

Hi John,

How do you use "format" to change the color,

any advice would certainly help!!

Cheers,

"John W. Vinson" wrote:

[Quoted Text]
> On Tue, 2 Dec 2008 14:37:01 -0800, DontKnow
> <DontKnow[ at ]discussions.microsoft.com> wrote:
>
> >I have also tried:
> >Me.textboxname.backcolor = rgb(255,0,0)
> >and still no luck!!
> >
> >I am using the textbox in a subform and datasheet view ( i believe that you
> >can change the backcolor of a textbox in a subform and datasheet view during
> >runtime??)
>
> Not in a datasheet to my knowledge - you can do so in a Continuous Form.
>
> Another option (which I believe works with datasheets too) is to use Format...
> Conditional Formatting from the menu.
> --
>
> John W. Vinson [MVP]
>
Re: Changing color of a textbox in a subform
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/3/2008 3:17:33 AM
On Tue, 2 Dec 2008 16:39:01 -0800, DontKnow
<DontKnow[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>Hi Guys,
>
>yes I am trying to update the textbox color in a datasheet view!!
>
>Hi John,
>
>How do you use "format" to change the color,
>
>any advice would certainly help!!

Open the Form in design view. Select the textbox bound to the field that you
want to change color. On the Menu choose "Format", and then select
"Conditional Formatting".

Choose the color you want using the color tool.
--

John W. Vinson [MVP]
Re: Changing color of a textbox in a subform
DontKnow 12/3/2008 10:59:03 AM
I just checked and conditional formatting does not work for the datasheet
view and subform for a text box!!

Thnaks for your help anyway!!

Cheers

"John W. Vinson" wrote:

[Quoted Text]
> On Tue, 2 Dec 2008 16:39:01 -0800, DontKnow
> <DontKnow[ at ]discussions.microsoft.com> wrote:
>
> >Hi Guys,
> >
> >yes I am trying to update the textbox color in a datasheet view!!
> >
> >Hi John,
> >
> >How do you use "format" to change the color,
> >
> >any advice would certainly help!!
>
> Open the Form in design view. Select the textbox bound to the field that you
> want to change color. On the Menu choose "Format", and then select
> "Conditional Formatting".
>
> Choose the color you want using the color tool.
> --
>
> John W. Vinson [MVP]
>
Re: Changing color of a textbox in a subform
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/3/2008 5:29:43 PM
On Wed, 3 Dec 2008 02:59:03 -0800, DontKnow
<DontKnow[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>I just checked and conditional formatting does not work for the datasheet
>view and subform for a text box!!

It does on my PC (A2003 SP3); I tried a second time to be sure. Just what did
you do???

--

John W. Vinson [MVP]
Re: Changing color of a textbox in a subform
Ron2006 <ronnemec[ at ]hotmail.com> 12/3/2008 5:37:35 PM
That is not accurate. Conditional formating works fine on datasheet
views.

I have and do use it extensively.

If you want one certain field to be red all the time then change the
condition on the conditional format screen to use an expression and
simply type True in the expression. and then choose the
formating that you want.

Ron

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net