?
Solved

Can I use VBA to do conditional formatting in an Access 2003 form?

Posted on 2010-08-27
8
Medium Priority
?
591 Views
Last Modified: 2013-11-28
Hello,
I have about 15 conditions to consider in the formatting of a particular text box on a form.  Since the Conditional Formatting on the menu bar allows a maximum of three conditions, I would like to know if I can get around this by using VBA.

Thank you.
0
Comment
Question by:Saleve
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 13

Expert Comment

by:lucas911
ID: 33541632
Sure you can try select case statement
Private Sub FormatBox(intFormatType as integer)

Select case intFormatType
CASE 1:
  Me.txtTextBox.BackColor = RGB(255, 255, 66)
  Me.txtTextBox.FontBold = True
CASE 2:
  Me.txtTextBox.BackColor = RGB(63, 25, 66)
  Me.txtTextBox.FontBold = False
CASE Else
  Me.txtTextBox.BackColor = RGB(255,255,255)
  Me.txtTextBox.FontBold = False
End Select

End Sub

Open in new window

0
 
LVL 5

Expert Comment

by:INHOUSERES
ID: 33541712
could also use these (if it's a number):

Case Is Between 1 and 6
Case Is >3
Case Is <=4
0
 

Author Comment

by:Saleve
ID: 33541756
Actually, I have a continuous form and each record needs to be considered separately.  That's the difficulty.  Is it possible in VBA or are we limited to the menu function to do this?
0
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
LVL 5

Expert Comment

by:INHOUSERES
ID: 33541804
What that be "onLoad"?

I'd be interested in this too!
0
 

Author Comment

by:Saleve
ID: 33541845
Format > Conditional Formatting (in Access 2003)
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 33541894
Unfortunately, not in a continuous form (in 2003).  However, this is possible in 2007, if that helps any.
0
 
LVL 5

Expert Comment

by:INHOUSERES
ID: 33541896
I'm aware of the conditional formatting.
Knowing how do to something to a textbox individually for a continuous form might NOT be possible.

I'm hoping, like you are, that an expert knows of a way.
0
 

Author Closing Comment

by:Saleve
ID: 33541933
I was afraid of that.  I'm going to look into upgrading.  It's about time (although it's not up to me...).

Thanks.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question