conditional macros for Access Database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm running confused here between Marcro's, SQL, and VB. I want to do enough
to get dangerous, but, I don't see myself as a Geek. I really don't know
where to start to get myself in the position to write conditional macro's,
SQL, or VB. Is there any help other then 2 semesters of Computer Science.

I wanted to highlight a field in different colors depending on the Answer
from 0-4. Where do I go to get started on the right track... I would take a
2 or 3 day seminar if I found one close to Sarasota, Fl. Thanks for any
help....
 
Hi,
Depending on you access version you can use conditional formatting which
exists in Acc2000 and higher. The formatting should happen at form level
since users should never see the table or query level. So after you creat an
interface (forms) for them you can use conditional formatting which you will
find under the format menu item in form design view to specify the different
conditions and formats. Unfortunately conditional formatting is limited to 3
conditions per control...so you might need to adapt VBA (visual basic for
applications) which office programs use. VB is something different. You can
easily use an if then else statement or a select case statement to on a
specific form event to achieve what you want.
HTH
Good luck
 
Chet,

You can easily do this with a macro.

Is 'Answer' the value of a control on your form? Maybe it is an Option
Group control?

From the Database Window, select Macros, and then click New.

If you can't see a Conditions column in the macro design window, select
it from the View menu.

In the Condition column, type this...
[Answer]=1
.... and then select SetValue in the Action column.
Then go to the Arguments panel towards the bottom of the window, and do
like this...
Item: [NameOfYourTextbox].[BackColor]
Expression: 255
(this is red)

Ok, now repeat this for the other 3 values for Answer. Close and save
the macro.

Then you need to decide *when* you want this to happen. Probably if you
look at the design view of the form, you should select the Answer
control, and find the Properties and enter the name of this macro in the
After Update event property. You will also probably want to put it on
the On Current event property of the form itself.
 
Back
Top