Continuous form and records

  • Thread starter Thread starter amir
  • Start date Start date
A

amir

I have a Continuous form that users will select name and
hours worked, annual, sick,.etc for one record. And in
that form you can have a multiple records, which lets you
fill out timesheet for multiple users at one form before
exiting. I need to validate that user had entered minimum
requirements before moving onto another record on same
form. Like total hours worked must be 8 or greater in
order for them to move onto next record. Not sure where to
place this and how to go about implementing it. It has to
be done after they have completed the whole record and
before they move onto next. Thank you.
 
I am not 100% if you are asking about how to validate multiple records for
ONE person that totals up to 8 hours, or just that you have a bunch of
records, and you want to ensure that EACH record, at least 8 hours is
entered?

If you are talking about individual records, then even in a continues form,
you can use the before update event of each detail record.

If you are talking about the main record, and all the child records *must*
add up to eight hours, then you could use the before update event in the
main record, and do a "sum" on the total hours.
 
Thank you for the reply.
I'm talking about validating each record to make sure it
adds up to 8 hours. I have tried setting up before update
on my continuous form a procedure that will validate the
record before they move onto next but somehow it lets
users through. If user enters 7 hours and tries to go to
next record message pops up and it blocks them going any
further, but if they try one more time they will get
message and then it lets them thru. I would like for it
keeps blocking them until they make total of 8 hours.
here is the procedure:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Total_Hours = ConvMins(Nz(PresentAllDay)) + ConvMins(Nz
(AnnualLeave)) + ConvMins(Nz(Holiday)) + ConvMins(Nz
(Otherleave)) + ConvMins(Nz(CompTime)) + ConvMins(Nz
(SickLeave))
Total_Hours = ConvHours(Nz(Total_Hours))
txtTotal_Minutes = ConvMins(Nz(PresentAllDay)) + ConvMins
(Nz(AnnualLeave)) + ConvMins(Nz(Holiday)) + ConvMins(Nz
(Otherleave)) + ConvMins(Nz(CompTime)) + ConvMins(Nz
(SickLeave))
txtCompTimeEarnedMin = ConvMins(Nz(ComptimeEarned))
txtPresentAllDayMin = ConvMins(Nz(PresentAllDay))
txtAnnualLeaveMin = ConvMins(Nz(AnnualLeave))
txtHolidayMin = ConvMins(Nz(Holiday))
txtOtherLeaveMin = ConvMins(Nz(Otherleave))
txtCompTimeMin = ConvMins(Nz(CompTime))
txtSickLeaveMin = ConvMins(Nz(SickLeave))
If Total_Hours < 8 And chkSSH = 0 Then
MsgBox " Total Hours must be Equal or Greater then 8,
please correct before proceeding", vbCritical, "Hudtrac"
PresentAllDay.SetFocus
End If

I also have module that will convert numbers into 60
minute clock. Which works fine.
 
Ok, I got it..
I don't know why I didn't see this before. I just needed a
statement on the end that says:
Cancel = -1
That was all.. I guess I just needed to look at it from a
different angle..
Thank you for your help.
 
Back
Top