I have a rental booking system for seven boats, and the reference number of each rental booking is placed in one of seven fields in a browse table.
A booking goes in the first free field, a subsequent booking in the next free field etc.
If all seven fields are filled (for that day) a "fully booked" message will be shown. The xbasic (below) is in the event �onsave� and works fine.
The problem is that if a record is changed for any reason, then when it is saved, the �onsave� xbasic looks for the next free field, and enters the reference number a second time.
The question is, how can I prevent this happening. Is there any way to say that if the reference number exists for that day, do not re-enter it. I am sure can achieve it by adding a second set of CASE(s) to look for the reference number, but is there a way to say, �on change� ignore the �onsave� xbasic.
Would appreciate any suggestions.
SELECT
CASE RENTAL8=.T..and. isblank("tbl.One")
tbl.One = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.two")
tbl.two = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.three")
tbl.three = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.four")
tbl.four = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.five")
tbl.five = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.six")
tbl.six = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.seven")
tbl.seven = RIBREF8
END SELECT
A booking goes in the first free field, a subsequent booking in the next free field etc.
If all seven fields are filled (for that day) a "fully booked" message will be shown. The xbasic (below) is in the event �onsave� and works fine.
The problem is that if a record is changed for any reason, then when it is saved, the �onsave� xbasic looks for the next free field, and enters the reference number a second time.
The question is, how can I prevent this happening. Is there any way to say that if the reference number exists for that day, do not re-enter it. I am sure can achieve it by adding a second set of CASE(s) to look for the reference number, but is there a way to say, �on change� ignore the �onsave� xbasic.
Would appreciate any suggestions.
SELECT
CASE RENTAL8=.T..and. isblank("tbl.One")
tbl.One = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.two")
tbl.two = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.three")
tbl.three = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.four")
tbl.four = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.five")
tbl.five = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.six")
tbl.six = RIBREF8
CASE RENTAL8=.T..and. isblank("tbl.seven")
tbl.seven = RIBREF8
END SELECT
Comment