By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,222 Members | 1,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,222 IT Pros & Developers. It's quick & easy.

Conditional Format Form within a Form

P: 5
Hey guys i'm kind of confused. I'm new to access but I've been getting a lot of progress.

I have a form FRMDATABASE that is loaded into FRMSEARCH and frm search has a bunch of txtboxes that searches the the FRMDATABASE but now I need to conditional format the data within the FRMDATABASE and I have to do it based of code sense I can't limit it to 3.

I use this on the report of the searched criteria and it works like a charm:
Expand|Select|Wrap|Line Numbers
  1. If [Description] Like "*" & "Print Not Available" & "*" Then
  2. [Description].BackColor = &H51A8FF
  3. [Description].FontBold = True
  4. [Description].ForeColor = vbBlack
  5. ElseIf [Description] Like "*" & "In Production" & "*" Then
  6. [Description].BackColor = vbYellow
  7. [Description].FontBold = True
  8. [Description].ForeColor = vbBlack
  9. Else
  10. [Description].BackColor = vbWhite
  11. [Description].FontBold = False
  12. [Description].ForeColor = vbBlack
  13. End If
  14.  
  15. If [General Notes] = "*" & "Ready to Ship on Rack" & "*" Then
  16. [General Notes].BackColor = &HA8ACFF
  17. [General Notes].FontBold = True
  18. [General Notes].ForeColor = vbBlack
  19. ElseIf [General Notes] Like "*" & "Need Test Sheet" & "*" Then
  20. [General Notes].BackColor = &HFFFF00
  21. [General Notes].FontBold = True
  22. [General Notes].ForeColor = vbBlack
  23. ElseIf [General Notes] Like "*" & "Error" & "*" Then
  24. [General Notes].BackColor = vbRed
  25. [General Notes].FontBold = True
  26. [General Notes].ForeColor = vbWhite
  27. ElseIf [General Notes] Like "*" & "Order on Hold" & "*" Then
  28. [General Notes].BackColor = vbRed
  29. [General Notes].FontBold = True
  30. [General Notes].ForeColor = vbWhite
  31. Else
  32. [General Notes].BackColor = vbWhite
  33. [General Notes].FontBold = False
  34. [General Notes].ForeColor = vbBlack
  35. End If
  36.  
I tried making this on the frmSearch under Public ConditionalFormat() <- my own public sub and call for it when they click the search button so the results are formatted.

It pups up errors and stuff.

Also FRMDatabase is based of a query qryDatabase which is based of the main table tblDatabase.

Thanks in Advance!
Jan 13 '08 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,357
Please use code tags.

Where is the Function located? In the form code module?
Where are you calling the function? From the report? Because you can't do that, it is out of the purview of the report.
And most importantly, what are these error messages you get? It helps to know what errors you're getting if we're going to resolve these errors.
Jan 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.