= versus > or <

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

Guest

Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On and 3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a greate
value to average I don't know write the code...

Thanks in advance.
an
 
Is txtValue bound to a field in T_Table? If so, what's the data type of the
field: text or numeric? If it's numeric, remove the quotes around 0.
 
Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare with
another condition > or < between greater or smallest Value with average (?)

an

Douglas J Steele said:
Is txtValue bound to a field in T_Table? If so, what's the data type of the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On and 3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a greate
value to average I don't know write the code...

Thanks in advance.
an
 
I'm sorry, I don't understand what you mean by "when I need to compare with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare with
another condition > or < between greater or smallest Value with average (?)

an

Douglas J Steele said:
Is txtValue bound to a field in T_Table? If so, what's the data type of the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a greate
value to average I don't know write the code...

Thanks in advance.
an
 
Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


Douglas J Steele said:
I'm sorry, I don't understand what you mean by "when I need to compare with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare with
another condition > or < between greater or smallest Value with average (?)

an

Douglas J Steele said:
Is txtValue bound to a field in T_Table? If so, what's the data type of the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a greate
value to average I don't know write the code...

Thanks in advance.
an
 
In the textbox's AfterUpdate event, you'd need logic to update the other 3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


Douglas J Steele said:
I'm sorry, I don't understand what you mean by "when I need to compare with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare with
another condition > or < between greater or smallest Value with
average
(?)
an

:

Is txtValue bound to a field in T_Table? If so, what's the data type
of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Ooops!
When I try to open the form return an error:

Variable not defined (?)
Thanks.
an


Douglas J Steele said:
In the textbox's AfterUpdate event, you'd need logic to update the other 3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


Douglas J Steele said:
I'm sorry, I don't understand what you mean by "when I need to compare with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare
with
another condition > or < between greater or smallest Value with average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data type of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Sorry:
An error is in 2nd row where is:

GreenOn

an

Douglas J Steele said:
In the textbox's AfterUpdate event, you'd need logic to update the other 3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


Douglas J Steele said:
I'm sorry, I don't understand what you mean by "when I need to compare with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare
with
another condition > or < between greater or smallest Value with average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data type of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Assuming GreenOn, GreenOff, etc. are all the names of controls, use
Me!GreenOn, Me!GreenOff, etc.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry:
An error is in 2nd row where is:

GreenOn

an

Douglas J Steele said:
In the textbox's AfterUpdate event, you'd need logic to update the other 3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color
(more
soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


:

I'm sorry, I don't understand what you mean by "when I need to
compare
with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare
with
another condition > or < between greater or smallest Value with average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data
type
of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights.
3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example
with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Ok. Thanks

The 1st error was turned.
Now, 2nd situation:

When change Value in textBox, return

"RunTime error '2448'. You can't assign a value to this object"

an

Douglas J Steele said:
Assuming GreenOn, GreenOff, etc. are all the names of controls, use
Me!GreenOn, Me!GreenOff, etc.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry:
An error is in 2nd row where is:

GreenOn

an

Douglas J Steele said:
In the textbox's AfterUpdate event, you'd need logic to update the other 3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more
soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


:

I'm sorry, I don't understand what you mean by "when I need to compare
with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare
with
another condition > or < between greater or smallest Value with
average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data type
of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights. 3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Value is a poor choice for a name: it's a reserved word. See whether
changing the name helps.

If not, how are you trying to change the value? Is it through code? If so,
post the code.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Ok. Thanks

The 1st error was turned.
Now, 2nd situation:

When change Value in textBox, return

"RunTime error '2448'. You can't assign a value to this object"

an

Douglas J Steele said:
Assuming GreenOn, GreenOff, etc. are all the names of controls, use
Me!GreenOn, Me!GreenOff, etc.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry:
An error is in 2nd row where is:

GreenOn

an

:

In the textbox's AfterUpdate event, you'd need logic to update the
other
3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg, then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color (more
soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


:

I'm sorry, I don't understand what you mean by "when I need to compare
with
another condition > or < between greater or smallest Value with average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to compare
with
another condition > or < between greater or smallest Value with
average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the
data
type
of
the
field: text or numeric? If it's numeric, remove the quotes around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the average;
ii - 6 colored OLEUnbound in Form to simulate traffic
lights.
3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for
example
with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
Ooops!!
Now I don't see the response wich I write to you in morning today.
Sorry for this but I think that it will have been any acidental my bad
procedure.

So:

"Value":
The original word is another ("Value" is after translation to english)

"Change values":
- I change value directly in text box (to here not problem);
- I would like to obtain result after new value with change unbound objects...

I posted today, in morning too, "2 in 1 questions" in this newsgroup.
More one time, sorry.
an

Douglas J Steele said:
Value is a poor choice for a name: it's a reserved word. See whether
changing the name helps.

If not, how are you trying to change the value? Is it through code? If so,
post the code.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Ok. Thanks

The 1st error was turned.
Now, 2nd situation:

When change Value in textBox, return

"RunTime error '2448'. You can't assign a value to this object"

an

Douglas J Steele said:
Assuming GreenOn, GreenOff, etc. are all the names of controls, use
Me!GreenOn, Me!GreenOff, etc.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry:
An error is in 2nd row where is:

GreenOn

an

:

In the textbox's AfterUpdate event, you'd need logic to update the other
3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg,
then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color
(more
soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


:

I'm sorry, I don't understand what you mean by "when I need to
compare
with
another condition > or < between greater or smallest Value with
average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to
compare
with
another condition > or < between greater or smallest Value with
average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data
type
of
the
field: text or numeric? If it's numeric, remove the quotes
around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the
average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights.
3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example
with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 
DS,

Problem solved with Me.Recalc in On Load
Thanks for all.
an

Douglas J Steele said:
Value is a poor choice for a name: it's a reserved word. See whether
changing the name helps.

If not, how are you trying to change the value? Is it through code? If so,
post the code.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Ok. Thanks

The 1st error was turned.
Now, 2nd situation:

When change Value in textBox, return

"RunTime error '2448'. You can't assign a value to this object"

an

Douglas J Steele said:
Assuming GreenOn, GreenOff, etc. are all the names of controls, use
Me!GreenOn, Me!GreenOff, etc.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry:
An error is in 2nd row where is:

GreenOn

an

:

In the textbox's AfterUpdate event, you'd need logic to update the other
3
boxes:

Me!Sum = Me!Sum + Me!Value
Me!Count = Me!Count + 1
Me!Avg = Me!Sum / Me!Count

Then, it should be as simple as

If Me!Value > Me!Avg Then
GreenOn.Visible = True
GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True
Else
If Me!Value < Me!Avg Then
RedOn. Visible = True
RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True
Else
YellowOn. Visible = True
YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry for my delay.

In form, I have 4 textboxes:

- Value (to enter to data)
- Sum (values of the Value field of the all records)
- Count (all records)
- Avg (to average: Sum/Count)

I would like to do example next:
- When the new Value is writed in textbox and this value is > Avg,
then:

GreenOn.Visible = True

GreenOff.Visible = False
YellowOn.Visible = False
YellowOff.Visible = True
RedOn.Visible = False
RedOff.Visible = True

If new Value is < Avg, then:

RedOn. Visible = True

RedOff.Visible = False
GreenOn.Visible = False
GreenOff.Visible = True
YellowOn.Visible = False
YellowOff. Visible = True3

and if the new value = Avg

YellowOn. Visible = True

YellowOff. Visible = False
RedOn.Visible = False
RedOff.Visible = True
GreenOn.Visible = False
GreenOff.Visible = True

For another words:
There are always 3 unbound objects visibles;
One "On" when condition is true;
And two "Off" if condition is false.

In adition, the unbound objects "Off", there are a filtered color
(more
soft);
The unbound objects "On" there are the more strong color.

Sorry if I didn't was explicit.
Thanks.
an


:

I'm sorry, I don't understand what you mean by "when I need to
compare
with
another condition > or < between greater or smallest Value with
average"

Can you give an example?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for your reply.

The txtValue is the textbox control name in Form.
The name field in T_Table is Value and is numeric type.
The comparison to 0, work fine. Only don't work when I need to
compare
with
another condition > or < between greater or smallest Value with
average
(?)

an

:

Is txtValue bound to a field in T_Table? If so, what's the data
type
of
the
field: text or numeric? If it's numeric, remove the quotes
around 0.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello!

I would like your help to next:

I have a Form based in T_Table.
In this form:
i - 2 TextBoxes to write a value and TextBox to calc the
average;
ii - 6 colored OLEUnbound in Form to simulate traffic lights.
3 to
On
and
3
to Off according of the value situation.

If I write in Event Procedure in On Curent of the Form:

' *************Start Code

Private Sub Form_Current()

If [txtValue] = "0" Then
Red_On.Visible = False
Yellow_On.Visible = False
Green_On.Visible = False

Red_Off.Visible = True
Yellow_Off.Visible = True
Green_Off.Visible = True

Else

If [txtValue] <> "0" Then
Red_On.Visible = True
Yellow_On.Visible = True
Green_On.Visible = True

Red_Off.Visible = False
Yellow_Off.Visible = False
Green_Off.Visible = False

End If
End If
End Sub

' **************End Code

Work fine (when compare with Zero).
But, when I need to compare different condition, for example
with
a
greate
value to average I don't know write the code...

Thanks in advance.
an
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top