A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is Null Testing for Combo On Opening Form



 
 
Thread Tools Display Modes
  #1  
Old March 30th, 2008, 09:13 PM posted to microsoft.public.access.forms
access user
external usenet poster
 
Posts: 78
Default Is Null Testing for Combo On Opening Form

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?
  #2  
Old March 30th, 2008, 09:18 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Is Null Testing for Combo On Opening Form

"Access User" wrote in message
news
I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?



I haven't tried this out, but why not just set the control's normal
BackColor to red? That way, if any of the three possible values has been
chosen, the conditional formatting will set the color accordingly, but if
not, the default color of red will be used.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #3  
Old March 30th, 2008, 09:37 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Is Null Testing for Combo On Opening Form

Dirk's suggestion seems the best approach to me, but for future reference the
correct syntax in Access VBA is not

If Me.TECHADEQ.Value Is Null Then

but rather

If IsNull(Me.TECHADEQ.Value) Then

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

  #4  
Old March 30th, 2008, 10:19 PM posted to microsoft.public.access.forms
access user
external usenet poster
 
Posts: 78
Default Is Null Testing for Combo On Opening Form

I tried that but it had the effect of causing the look up list's responses to
be appear uniformly in RED (albeit with black foreground). I think that
looked kind of funky.


"Dirk Goldgar" wrote:

"Access User" wrote in message
news
I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?



I haven't tried this out, but why not just set the control's normal
BackColor to red? That way, if any of the three possible values has been
chosen, the conditional formatting will set the color accordingly, but if
not, the default color of red will be used.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #5  
Old March 30th, 2008, 10:23 PM posted to microsoft.public.access.forms
access user
external usenet poster
 
Posts: 78
Default Is Null Testing for Combo On Opening Form

Unless I'm mistooked, this approach via VBA has the same net effect on the
display as Dirk's.

"Linq Adams via AccessMonster.com" wrote:

Dirk's suggestion seems the best approach to me, but for future reference the
correct syntax in Access VBA is not

If Me.TECHADEQ.Value Is Null Then

but rather

If IsNull(Me.TECHADEQ.Value) Then

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com


  #6  
Old March 31st, 2008, 04:40 PM posted to microsoft.public.access.forms
Stockwell43
external usenet poster
 
Posts: 579
Default Is Null Testing for Combo On Opening Form

Hi Access User,

Try this:

If IsNull(TECHADEQ) = True Then
Me.TECHADEQ.BackColor = vbRed
End If



"Access User" wrote:

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?

  #7  
Old March 31st, 2008, 05:01 PM posted to microsoft.public.access.forms
access user
external usenet poster
 
Posts: 78
Default Is Null Testing for Combo On Opening Form

As is true of the other profers, the effect this has is to not only color the
background of the field being entered on the form but the background color of
the three choices appearing in the look up list when the user clicks on the
down pointing arrow. I would really prefer to have just the entry field on
the form showing up with the red background when it's value is nullity AND
the native black foreground and white background.

"Stockwell43" wrote:

Hi Access User,

Try this:

If IsNull(TECHADEQ) = True Then
Me.TECHADEQ.BackColor = vbRed
End If



"Access User" wrote:

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?

  #8  
Old March 31st, 2008, 06:10 PM posted to microsoft.public.access.forms
Stockwell43
external usenet poster
 
Posts: 579
Default Is Null Testing for Combo On Opening Form

Try this in your Forms Current Event

If IsNull(Me.txtDateFrom) = "True" Then
Me.txtDateFrom.BackColor = "255"

ElseIf IsNull(Me.txtDateFrom) = "False" Then
Me.txtDateFrom.BackColor = "16777215"
Else
End If

I just tried it in a test database and it worked fine, give a go.

"Access User" wrote:

As is true of the other profers, the effect this has is to not only color the
background of the field being entered on the form but the background color of
the three choices appearing in the look up list when the user clicks on the
down pointing arrow. I would really prefer to have just the entry field on
the form showing up with the red background when it's value is nullity AND
the native black foreground and white background.

"Stockwell43" wrote:

Hi Access User,

Try this:

If IsNull(TECHADEQ) = True Then
Me.TECHADEQ.BackColor = vbRed
End If



"Access User" wrote:

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?

  #9  
Old March 31st, 2008, 06:11 PM posted to microsoft.public.access.forms
Stockwell43
external usenet poster
 
Posts: 579
Default Is Null Testing for Combo On Opening Form

Sorry, I forgot to change the name:

If IsNull(Me.TECHADEQ) = "True" Then
Me.txtDateFrom.BackColor = "255"

ElseIf IsNull(Me.TECHADEQ) = "False" Then
Me.txtDateFrom.BackColor = "16777215"
Else
End If

"Access User" wrote:

As is true of the other profers, the effect this has is to not only color the
background of the field being entered on the form but the background color of
the three choices appearing in the look up list when the user clicks on the
down pointing arrow. I would really prefer to have just the entry field on
the form showing up with the red background when it's value is nullity AND
the native black foreground and white background.

"Stockwell43" wrote:

Hi Access User,

Try this:

If IsNull(TECHADEQ) = True Then
Me.TECHADEQ.BackColor = vbRed
End If



"Access User" wrote:

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?

  #10  
Old March 31st, 2008, 07:05 PM posted to microsoft.public.access.forms
access user
external usenet poster
 
Posts: 78
Default Is Null Testing for Combo On Opening Form

Hi,

I think you meant to say try this

If IsNull(Me.TECHADEQ) = "True" Then
Me.TECHADEQ.BackColor = "255"

ElseIf IsNull(Me.TECHADEQ) = "False" Then
Me.TECHADEQ.BackColor = "16777215"
Else
End If

but it seemed to not have the effect on the lookup list's background color
we're looking to get, i.e. to display white background.



"Stockwell43" wrote:

Sorry, I forgot to change the name:

If IsNull(Me.TECHADEQ) = "True" Then
Me.txtDateFrom.BackColor = "255"

ElseIf IsNull(Me.TECHADEQ) = "False" Then
Me.txtDateFrom.BackColor = "16777215"
Else
End If

"Access User" wrote:

As is true of the other profers, the effect this has is to not only color the
background of the field being entered on the form but the background color of
the three choices appearing in the look up list when the user clicks on the
down pointing arrow. I would really prefer to have just the entry field on
the form showing up with the red background when it's value is nullity AND
the native black foreground and white background.

"Stockwell43" wrote:

Hi Access User,

Try this:

If IsNull(TECHADEQ) = True Then
Me.TECHADEQ.BackColor = vbRed
End If



"Access User" wrote:

I have a combo box which has three possible values, e.g "Poor", "Fair" and
"Good". I have conditionally formatted each so that when they choose Poor
it's got a green background, Fair gets a yellow and Poor gets a red
background treatment. When they open the form they see an empty data entry
field. The field is required entry. I would like the background to be Red
when they open the form to grab their attention.

I have tried the following VBA but get a 424 error:

Private Sub Form_Load()

If Me.TECHADEQ.Value Is Null Then
Me![TECHADEQ].BackColor = vbRed
End If

End Sub

Is there an other approach?

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.