Hi Henry,
I would do this a little bit differently. I will allow user to selects doctor and date and use GetDateSlots method below to get all available slots. The result will be displayed in the grid so user can pick desired slot.
PROCEDURE GetDateSlots
LPARAMETERS tdAppDate, tnDocNumber
SELECT app_date, app_time, blocked, lcl_number ;
FROM appointments ;
WHERE app_date = tdAppDate AND lcl_number = tnDocNumber ;
INTO CURSOR appointmentlist NOFILTER
SELECT tdAppDate AS app_date, app_time, Appointime, slot_refer ;
FROM timeslots;
WHERE timeslots.app_time NOT IN ( ;
SELECT app_time FROM appointmentlist) ;
INTO CURSOR AvailableTimeSlotsForThisDoctor NOFILTER;
ENDPROC
You can also add 'Next Day' button so user would have easier vay to move to the next day.
>Hi all:
>
>I am working on a form which is expected to do the following:
>
>1. Select a name from the combobox (this works)
>2. User clicks the "Find Slot" commandbutton which has the following code:
>
< snip >
>
>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.
>
>
>Where am I going wrong? Thank you for your advise.
--sb--