SELECT app_date, app_time, blocked, lcl_number FROM appointments ; INTO CURSOR appointmentlist NOFILTER ; WHERE app_date=DATE(); ORDER BY appointments.app_date,lcl_number SELECT app_time,Appointime,slot_refer FROM timeslots; INTO CURSOR AvailableTimeSlotsForThisDoctor NOFILTER; WHERE timeslots.app_time <> appointmentlist.app_time .and.; appointmentlist.app_date = mToday .and.; && mToday = date() appointmentlist.lcl_number = mDoc_number GO top mNextDate = DATE() mNextSlot = AvailableTimeSlotsForThisDoctor.app_time mCurrentSlot = AvailableTimeSlotsForThisDoctor.app_time thisform.Refresh()3. User clicks the command button "Find Next Slot", which fires the following code:
DO WHILE mSelectThisSlot =.f. IF mCurrentslot = 2400 && This is midnight, so change the date mNextDate = mNextDate + 1 SELECT app_date, app_time, blocked, lcl_number FROM appointments ; INTO CURSOR appointmentlist NOFILTER ; WHERE app_date = mNextDate; ORDER BY appointments.app_date,lcl_number IF _tally >0 SELECT app_time,Appointime,slot_refer FROM timeslots; INTO CURSOR AvailableTimeSlotsForThisDoctor NOFILTER; WHERE timeslots.app_time <> appointmentlist.app_time .and.; appointmentlist.app_date = mNextDate .and.; appointmentlist.lcl_number = mDoc_number GO top mNextSlot = AvailableTimeSlotsForThisDoctor.app_time mCurrentSlot = AvailableTimeSlotsForThisDoctor.app_time IF !EOF() skip ENDIF ENDIF ELSE SELECT AvailableTimeSlotsForThisDoctor mNextSlot = AvailableTimeSlotsForThisDoctor.app_time mCurrentSlot = AvailableTimeSlotsForThisDoctor.app_time IF !EOF() skip ELSE mNextDate = mNextDate + 1 LOOP ENDIF ENDIF ENDDO THISFORM.Refresh()This is where i am not achieving the desired outcome. What I want happenning each time the user clicks "Find Next Slot" that all available timeslots are reflected in the two text boxes on the form, one show the date that is being processed and the other the timeslot. Clicking on the "Select this" command button sets mSeletThisSlot = .t. at which time the Do While loop should exit.