Need help please

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

Guest

I have a form that has several text boxes. They are labled box
1,2,3,4,5,6.The boxes are used for measurements. There is also two other
boxes that contain a +/- tolerance numbers. I would like the form to
determine if the measurement i have added to any given box could indicate if
it was out of tolerance. I would like the box that indicated an out of
tolerance condition have the number in red. Is this possible, and could
someone help me with this?

Thanks
 
Ron,
I guess I'm a bit confused... you have a plus tolerance and a minus
tolerance, but where are you storing your "exact" measurement.
Ex. Given an optimum value of 10 with a +1/-1 tolerance... values from 9
to 11 would be allowed.

For the sake of this example, I'll use a field called OptimumVal as the
"target" value.
On the AfterUpdate event for each of your 6 measurement fields... (use
your own names)
IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] < ([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If
hth
Al Camp
 
AlCamp,
I did what you suggested and it did not work. I get an error messege that
says compile: syntax error and the staement is in red. Am I doing something
wrong?

I want to say that my form is created from a Query. The +/- tolerence levels
are on another form that is inputed to this form. The exact measurement that
i will be using will be inputted into another field above the one I want to
indicate out of tolerence. Hope this will help to clear up any issues.

AlCamp said:
Ron,
I guess I'm a bit confused... you have a plus tolerance and a minus
tolerance, but where are you storing your "exact" measurement.
Ex. Given an optimum value of 10 with a +1/-1 tolerance... values from 9
to 11 would be allowed.

For the sake of this example, I'll use a field called OptimumVal as the
"target" value.
On the AfterUpdate event for each of your 6 measurement fields... (use
your own names)
IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] < ([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If
hth
Al Camp

Ron said:
I have a form that has several text boxes. They are labled box
1,2,3,4,5,6.The boxes are used for measurements. There is also two other
boxes that contain a +/- tolerance numbers. I would like the form to
determine if the measurement i have added to any given box could indicate
if
it was out of tolerance. I would like the box that indicated an out of
tolerance condition have the number in red. Is this possible, and could
someone help me with this?

Thanks
 
Ron,
The first line of code (The IF to the Then line) must be all on one line.
Email posts often break up long lines, so when entering code you got from an
email post, make sure to correct for that possibility. An If... Then
statement must be on one line.

IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] < ([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If

hth
Al Camp

Ron said:
AlCamp,
I did what you suggested and it did not work. I get an error messege that
says compile: syntax error and the staement is in red. Am I doing
something
wrong?

I want to say that my form is created from a Query. The +/- tolerence
levels
are on another form that is inputed to this form. The exact measurement
that
i will be using will be inputted into another field above the one I want
to
indicate out of tolerence. Hope this will help to clear up any issues.

AlCamp said:
Ron,
I guess I'm a bit confused... you have a plus tolerance and a minus
tolerance, but where are you storing your "exact" measurement.
Ex. Given an optimum value of 10 with a +1/-1 tolerance... values from
9
to 11 would be allowed.

For the sake of this example, I'll use a field called OptimumVal as
the
"target" value.
On the AfterUpdate event for each of your 6 measurement fields... (use
your own names)
IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] <
([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If
hth
Al Camp

Ron said:
I have a form that has several text boxes. They are labled box
1,2,3,4,5,6.The boxes are used for measurements. There is also two
other
boxes that contain a +/- tolerance numbers. I would like the form to
determine if the measurement i have added to any given box could
indicate
if
it was out of tolerance. I would like the box that indicated an out of
tolerance condition have the number in red. Is this possible, and could
someone help me with this?

Thanks
 
-----Original Message-----
AlCamp,
I did what you suggested and it did not work. I get an error messege that
says compile: syntax error and the staement is in red. Am I doing something
wrong?

I want to say that my form is created from a Query. The +/- tolerence levels
are on another form that is inputed to this form. The exact measurement that
i will be using will be inputted into another field above the one I want to
indicate out of tolerence. Hope this will help to clear up any issues.

AlCamp said:
Ron,
I guess I'm a bit confused... you have a plus tolerance and a minus
tolerance, but where are you storing your "exact" measurement.
Ex. Given an optimum value of 10 with a +1/-1 tolerance... values from 9
to 11 would be allowed.

For the sake of this example, I'll use a field called OptimumVal as the
"target" value.
On the AfterUpdate event for each of your 6 measurement fields... (use
your own names)
IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] < ([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If
hth
Al Camp

I have a form that has several text boxes. They are labled box
1,2,3,4,5,6.The boxes are used for measurements. There is also two other
boxes that contain a +/- tolerance numbers. I would like the form to
determine if the measurement i have added to any given box could indicate
if
it was out of tolerance. I would like the box that indicated an out of
tolerance condition have the number in red. Is this possible, and could
someone help me with this?

Thanks
.
 
AlCamp,
I entered the statement correctly and no error messege, but when I am using
it the numbers turn red as they should. Also, so do all the records for that
box change to red. They are not diferent for each record.

AlCamp said:
Ron,
The first line of code (The IF to the Then line) must be all on one line.
Email posts often break up long lines, so when entering code you got from an
email post, make sure to correct for that possibility. An If... Then
statement must be on one line.

IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] < ([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If

hth
Al Camp

Ron said:
AlCamp,
I did what you suggested and it did not work. I get an error messege that
says compile: syntax error and the staement is in red. Am I doing
something
wrong?

I want to say that my form is created from a Query. The +/- tolerence
levels
are on another form that is inputed to this form. The exact measurement
that
i will be using will be inputted into another field above the one I want
to
indicate out of tolerence. Hope this will help to clear up any issues.

AlCamp said:
Ron,
I guess I'm a bit confused... you have a plus tolerance and a minus
tolerance, but where are you storing your "exact" measurement.
Ex. Given an optimum value of 10 with a +1/-1 tolerance... values from
9
to 11 would be allowed.

For the sake of this example, I'll use a field called OptimumVal as
the
"target" value.
On the AfterUpdate event for each of your 6 measurement fields... (use
your own names)
IF [Meas1] > ([OptimumVal] - [MinTol]) AND [Meas1] <
([OptimumVal] +
[PlusTol]) Then
[Meas1].Forecolor = vbBlack
Else
[Meas1].Forecolor = vbRed
End If
hth
Al Camp

I have a form that has several text boxes. They are labled box
1,2,3,4,5,6.The boxes are used for measurements. There is also two
other
boxes that contain a +/- tolerance numbers. I would like the form to
determine if the measurement i have added to any given box could
indicate
if
it was out of tolerance. I would like the box that indicated an out of
tolerance condition have the number in red. Is this possible, and could
someone help me with this?

Thanks
 
AlCamp,
I entered the statement correctly and no error messege, but when I am using
it the numbers turn red as they should. Also, so do all the records for that
box change to red. They are not diferent for each record.

You didn't mention that you were using a Continuous form - Al's
suggestion is (of course) correct for a single form, but on continuous
forms it won't work as expected. You actually have only ONE textbox,
shown many times - so changing its properties changes them for all
instances.

With Access2000 and later, you can use the new feature Conditional
Formatting. Select the textbox, and choose Format... Conditional
Formatting. You can put an expression or a value in the menu you'll
get, and control the color (or other properties) of the textbox
depending on whether the condition is true or false.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top