General information
Category:
Coding, syntax & commands
Title:
Record is out of range, in a locate statement
I have a form which reads input from a barcode wand. One of my methods contain code that checks to see if an employee has already clocked in. Periodically i am getting an error: "record is out of range" What can I do to avoid this?
It is occuring in the locate statement below (line 17)....
*****************************************************************
* this procedure checks to see if there is already a clockin *
*****************************************************************
cEmpNo=alltrim(thisform.empnobox.value)
cPayEmpNo='E'+substr((cEmpNo),3)
lClockedIn=.f.
cDate=dtoc(date(),1)
nNow=thisform.zTimeToMinutes( (Datetime()) )
If upper(right(cEmpNo,1))=='A' and nNow<=240
&&if second shift and time between 00:00 and 04:00 am
&&set date back one day
cDate=dtoc( (date(year(date()),month(date()),(day(date())-1))),1 )
endif
SELECT bcshared
set order to forg_date descending
locate for forg_date=(cDate) and alltrim(fnction)=='F1' and alltrim(fempno)==(cEmpNo)
if found()
lClockedIn=.t.
endif
return lClockedIn
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only