Double Entry of Data

G

Guest

I am working on a scholarship program. There are two fields: 1) Actual GPA
(this includes the reported weighted GPA from a student's transcript that can
be higher than a 4.0; 2) GPA (this is the GPA we use for our purposes...it
is the same as the Actual GPA except that it has a maximum of 4.0. Therefore
an "Actual GPA" of 4.13 would have a "GPA" of 4.0. I have set up a form in
order to enter student information directly into a table. What I would like
to happen is when I enter the "Actual GPA" from the student's transcript that
it also be copied to the "GPA" column while changing anything over a 4.0 to
4.0.
Any help will be welcomed.
 
A

Allan Murphy

Chris

Using the afterupdate event for Actual GPA field. Note try and keep the
field name as one word e.g ActualGPA or actual_gpa etc.
Otherwise you will encounter problems in your coding when referring to field
etc

if me!actual_gpa >=4 then
me!gpa=4
else
me!gpa=me!actual_gpa
end if
 
R

Ron Hinds

Add some code to the AfterUpdate event of the Actual GPA field like so
(assume the controls' names are txtActual and txtGP):

If CDbl(txtActual) > 4.0# Then
txtGPA = "4.0"
Else
txtGPA = txtActual
End If
 
G

Guest

Do not store the GPA in that field. It is essentially derived data. What
happens if there is a mistake and you have to change someone's Actual GPA? It
would be very easy to forget to change the GPA to the correct value. (Too bad
that Access doesn't have triggers like Oracle to take care of this stuff.)

Therefore uses something like the following in queries, reports, and forms
when you want to see the GPA:

IIf([Actual GPA] > 4, 4, [Actual GPA])

You could put this in a query with all other fields in the table then use
this query instead of the table.
 

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