What the event should I use?

G

Guest

I have a form on which the user would enter the data into some fields, i.e.,
enter scores. There is a field to hold the sum of these scores, intTotal.
Based on the value of intTotal, I write some codes that would show a label
"A" or "B" or "C" or "D". These four labels are already on the form and are
invisible at the begining. After the user entered the scores, the program
will pop up one of these labels. The problem is when I advance to the next
record using the Access built-in navigation, the previous label of the
previous record is still there. My questions are:

1. Do you know how to get rid of this previous label so that when the user
advance to the next record, the form will be clear from the previous label
rating and ready to show the next label.
2. I want to save the intTotal into the [Total] field so the information
will be stored into my table. Same thing with the Rating. How can I do that?

Thank you for your help in advance. tim
 
A

Al Campagna

Tim,
Use the OnCuurent event of the form to decide which labels to show depending on some
value... or don't show any at all if no value exists.
 
G

Guest

Hi Al,
Thank you for your help. Actually, I did use the event OnCurrent, but the
previous label is still there when I click Next to go to the next record.
Here are my codes that I put in the OnCurrent, and OnLoad.
------
If IsNull(intTotalScores.Value) Or intTotalScores.Value = "" Or
intTotalScores.Value = 0 Then
lblA.Visible = False
lblB.Visible = False
lblC.Visible = False
lblD.Visible = False
End If
------
I don't know what the problem is. Perhaps I use a main form and subform and
the user enters data in the subform and those events are in the subform also.
Do you think main and subform make things behaving differently?
Again, thanks for your help - tim



Al Campagna said:
Tim,
Use the OnCuurent event of the form to decide which labels to show depending on some
value... or don't show any at all if no value exists.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Tim said:
I have a form on which the user would enter the data into some fields, i.e.,
enter scores. There is a field to hold the sum of these scores, intTotal.
Based on the value of intTotal, I write some codes that would show a label
"A" or "B" or "C" or "D". These four labels are already on the form and are
invisible at the begining. After the user entered the scores, the program
will pop up one of these labels. The problem is when I advance to the next
record using the Access built-in navigation, the previous label of the
previous record is still there. My questions are:

1. Do you know how to get rid of this previous label so that when the user
advance to the next record, the form will be clear from the previous label
rating and ready to show the next label.
2. I want to save the intTotal into the [Total] field so the information
will be stored into my table. Same thing with the Rating. How can I do that?

Thank you for your help in advance. tim
 
A

Al Campagna

Tim,
If the intTotalScores is in the subform and the labels are on the main form, that's the
problem.
Try... On Current
intTotalScores.Value = 0 Then
Forms!frmMainFormName!lblA.Visible = False
Forms!frmMainFormName!lblB.Visible = False
Forms!frmMainFormName!lblC.Visible = False
Forms!frmMainFormName!lblD.Visible = False
End If

and the same code on AfterUpdate of intTotalScores.

If that doesn't work, please describe your main form, subform, and labels.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Tim said:
Hi Al,
Thank you for your help. Actually, I did use the event OnCurrent, but the
previous label is still there when I click Next to go to the next record.
Here are my codes that I put in the OnCurrent, and OnLoad.
------
If IsNull(intTotalScores.Value) Or intTotalScores.Value = "" Or
intTotalScores.Value = 0 Then
lblA.Visible = False
lblB.Visible = False
lblC.Visible = False
lblD.Visible = False
End If
------
I don't know what the problem is. Perhaps I use a main form and subform and
the user enters data in the subform and those events are in the subform also.
Do you think main and subform make things behaving differently?
Again, thanks for your help - tim



Al Campagna said:
Tim,
Use the OnCuurent event of the form to decide which labels to show depending on some
value... or don't show any at all if no value exists.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Tim said:
I have a form on which the user would enter the data into some fields, i.e.,
enter scores. There is a field to hold the sum of these scores, intTotal.
Based on the value of intTotal, I write some codes that would show a label
"A" or "B" or "C" or "D". These four labels are already on the form and are
invisible at the begining. After the user entered the scores, the program
will pop up one of these labels. The problem is when I advance to the next
record using the Access built-in navigation, the previous label of the
previous record is still there. My questions are:

1. Do you know how to get rid of this previous label so that when the user
advance to the next record, the form will be clear from the previous label
rating and ready to show the next label.
2. I want to save the intTotal into the [Total] field so the information
will be stored into my table. Same thing with the Rating. How can I do that?

Thank you for your help in advance. tim
 
G

Guest

Hi Al,
The intTotalScores is in the subform and the labels are in the same subform
also. I tried to put the same codes in the AfterUpdate event of
intTotalScores. However, AfterUpdate is only executed AFTER I enter the test
data in (i.e., the scores) and
therefore, the previous label is still there until all the scores entered
and the AfterUpdate will be executed. When I move to the new record by
clicking on the next button in the bottom of form, I would like to see no
label at all until after I entered the scores.
I guess there is one way to solve this problem is I have to create my own
Next, Back, Add, Delete, etc. buttons. When I click on the next button, I can
clear up everything by putting some codes, but this way is very time
consumming. Is there anything else I can work without using this method?

Here is the design: I have a main form and a subform. The main form contains
information of a specific person, i.e., a student's name, stud's address,
etc. This main form simply pulls data from a table, so the user does not have
to typing in the data. The subform contains information about that student's
test scores that the user has to typing the data in. The details of the
subform I already posted in the first message. Thank you - tim

Al Campagna said:
Tim,
If the intTotalScores is in the subform and the labels are on the main form, that's the problem.
Try... On Current
intTotalScores.Value = 0 Then
Forms!frmMainFormName!lblA.Visible = False
Forms!frmMainFormName!lblB.Visible = False
Forms!frmMainFormName!lblC.Visible = False
Forms!frmMainFormName!lblD.Visible = False
End If

and the same code on AfterUpdate of intTotalScores.

If that doesn't work, please describe your main form, subform, and labels.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Tim said:
Hi Al,
Thank you for your help. Actually, I did use the event OnCurrent, but the
previous label is still there when I click Next to go to the next record.
Here are my codes that I put in the OnCurrent, and OnLoad.
------
If IsNull(intTotalScores.Value) Or intTotalScores.Value = "" Or
intTotalScores.Value = 0 Then
lblA.Visible = False
lblB.Visible = False
lblC.Visible = False
lblD.Visible = False
End If
------
I don't know what the problem is. Perhaps I use a main form and subform and
the user enters data in the subform and those events are in the subform also.
Do you think main and subform make things behaving differently?
Again, thanks for your help - tim



Al Campagna said:
Tim,
Use the OnCuurent event of the form to decide which labels to show depending on some
value... or don't show any at all if no value exists.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I have a form on which the user would enter the data into some fields, i.e.,
enter scores. There is a field to hold the sum of these scores, intTotal.
Based on the value of intTotal, I write some codes that would show a label
"A" or "B" or "C" or "D". These four labels are already on the form and are
invisible at the begining. After the user entered the scores, the program
will pop up one of these labels. The problem is when I advance to the next
record using the Access built-in navigation, the previous label of the
previous record is still there. My questions are:

1. Do you know how to get rid of this previous label so that when the user
advance to the next record, the form will be clear from the previous label
rating and ready to show the next label.
2. I want to save the intTotal into the [Total] field so the information
will be stored into my table. Same thing with the Rating. How can I do that?

Thank you for your help in advance. tim
 

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

Top