Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Text Box Color Change Inconsistent.

Status
Not open for further replies.

joel009

Programmer
Jul 7, 2000
272
US
Hi All!!!
On a form I am using a subform that lists rows. As the subform Detail_Paint event is called I have this code:

If IsNull(Me.txtPart.Value) = True Then
Me!txtPartNumber.BackColor = RGB(255, 255, 153)
Else
Me!txtPartNumber.BackColor = RGB(255, 255, 255)
End If

This works fine for 3,4,5 selection changes and then it gives an error:
Run_Time error 2424.
The expression you entered has a field, control or property name that Microsoft Access can't find.

Should I be using another event? I don't know why it works and then fails.

Any ideas?

Thanks!

Joel



Joel
 
You should be using conditional formatting.
 
Just not familiar with that. Will check into it.

Thanks,

Joel

Joel
 
OK - I tried using the Conditional Formatting. I set it to
value <> txtPart and they all paint. Could it be because I am comparing to a null?

Joel
 
You would set the conditional formatting of the control you want to format. Use the "Expression Is" and set it to:
Code:
  [txtPart] Is Null
Make sure the []s are included.

Duane
Hook'D on Access
MS Access MVP
 
I ended up with Value <> Nz([txtPart],0)
This compares one fields value to another and works fine.

Now I am trying to figure out how to set a field based on the value in another field where the 2 fields do not match.

I have a check box that if not checked I want to change the color of the PartNumber field.

Is this possible with the Conditional Formatting?

Thanks,
Joel


Joel
 
I figured it out!!!!

Thanks for all the help.

Joel

Joel
 
In Conditional Formatting for txtPart I added:

Expression is [checkbox]<> -1 using the builder.


Thanks again.

joel

Joel
 
In conditional formatting, in the far left combo of a condition you have choices:
Field value is
Expression is
Field has focus

Using "Expression is" you can reference other fields, like
[chkOne] = True

However, that is redundant and it can simply be written
[chkOne]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top