C
Chad
Using MS Access 2002 sp2
I've looked for sample code through help and web sites but I can't seem to
get this statement to work. I'm still just learning the VBA end of Access
so this will prob. be simple for many.
Problem: I have a form which is filled out with livestock load information
from a truckers log.
The three of the fields needed in my calculation are: "NetWeightUnloaded",
"AvgerageHogWeightUnloaded" and "Cripples". The NetWeightUnloaded is
entered first which auto calculates the Average, then the Cripples. What
I'm trying to code is: If the Cripple field is not null then multiply the
AverageHogWeightUnloaded by the number of Cripples and put that number in
the NetUnloadedWeight field then move to the next entry on the form after
the Cripples which is labeled "One". Now if the Cripple field is null I need
it just to move to the next when hitting tab.
Here is what I've tried in the AfterUpdate of Cripples:
Private Sub Cripples_AfterUpdate()
Dim ctl As Control
Set ctl = Forms![Log Form Correction query]![One]
If IsNull([Cripples]) Then
Me![Cripples] = "0"
DoCmd.GoToControl ctl.[One]
Else
Me![NetWeightUnLoaded] = Sum(([AvgerageHogWeightUnLoaded]) * [Crips])
DoCmd.GoToControl ctl.[One]
End If
End Sub
All suggestions would be appreciated.
Thanks,
Chad
I've looked for sample code through help and web sites but I can't seem to
get this statement to work. I'm still just learning the VBA end of Access
so this will prob. be simple for many.
Problem: I have a form which is filled out with livestock load information
from a truckers log.
The three of the fields needed in my calculation are: "NetWeightUnloaded",
"AvgerageHogWeightUnloaded" and "Cripples". The NetWeightUnloaded is
entered first which auto calculates the Average, then the Cripples. What
I'm trying to code is: If the Cripple field is not null then multiply the
AverageHogWeightUnloaded by the number of Cripples and put that number in
the NetUnloadedWeight field then move to the next entry on the form after
the Cripples which is labeled "One". Now if the Cripple field is null I need
it just to move to the next when hitting tab.
Here is what I've tried in the AfterUpdate of Cripples:
Private Sub Cripples_AfterUpdate()
Dim ctl As Control
Set ctl = Forms![Log Form Correction query]![One]
If IsNull([Cripples]) Then
Me![Cripples] = "0"
DoCmd.GoToControl ctl.[One]
Else
Me![NetWeightUnLoaded] = Sum(([AvgerageHogWeightUnLoaded]) * [Crips])
DoCmd.GoToControl ctl.[One]
End If
End Sub
All suggestions would be appreciated.
Thanks,
Chad