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. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|