Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crazy behavior
Message
From
07/03/2004 13:35:19
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Crazy behavior
Miscellaneous
Thread ID:
00883910
Message ID:
00883910
Views:
56
OK this is driving me crazy. I have a database of dates and times in 15 minute increments that keep information about scheduled events. Entering events into the database is fine however when I try to delete and event that ends at 12:15 pm, the 12:15 record does not get operated on. All other times work fine, even when 12:15 is included in the range. The following is the code. The form keeps a tToTime property, datetime of the end time and a tFromTime as datatime of starttime. lz calculates the difference between the two times in the number of 15minute increments. So a tFromtime of 11:30am and tToTime of 12:15pm is 4 15minute increments. A For..endfor loop goes from 1 to the lz value and operates on the records. When debugging everything goes fine, except when the endtime is 12:15. Then the For loops jumps out early by one. This just doesn’t make sense. Any Help would be appreciated.

Peter V.
LOCAL lnAnswer, lz, lx, lnIntNum, ldCheckTime, lcIntVar, lcIntVar2
lz=((THISFORM.tTotime-THISFORM.tFromtime)/900)+1
lnIntNum=THISFORM.nIntNum
lcIntVar="int"+ALLTRIM(STR(lnIntNum))
lcIntVar2="int"+ALLTRIM(STR(lnIntNum))+"a"

lnAnswer=MESSAGEBOX("Are you sure you want to Delete this Event?",36,"Delete Event")
IF lnAnswer=6
	SELECT sched
	IF FLOCK()
		SELECT dbevents
		IF FLOCK()
			******REMOVE EVENT
			SELECT sched
			FOR lx=1 TO lz STEP 1
				ldCheckTime=THISFORM.tfromtime+((lx-1)*900)
				IF SEEK(ldCheckTime)
					REPLACE &lcIntVar WITH ""
					REPLACE &lcIntVar2 WITH 0
				ENDIF					
			ENDFOR
			*******DELETE a dbEvent
			SELECT v_dbEvents
			DELETE
			=MESSAGEBOX("Event Deleted",64,"Event Deleted")
			THISFORM.Release
			UNLOCK
			SELECT sched
			UNLOCK
		ELSE
			=MESSAGEBOX("Unable to Delete Event...Try Again Later",16,"No File Lock")
			SELECT sched
			UNLOCK
		ENDIF
	ELSE
		=MESSAGEBOX("Unable to Delete Event...Try Again Later",16,"No File Lock")
	ENDIF
ENDIF
Next
Reply
Map
View

Click here to load this message in the networking platform