Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp50 - Using BLANK records as new records?
Message
From
21/05/1997 09:03:28
Larry Long
ProgRes (Programming Resources)
Georgia, United States
 
 
To
21/05/1997 08:34:26
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00032970
Message ID:
00033068
Views:
48
>>>I want to use up all the BLANK records that were made with a APPEND BLANK but never used. I do not want to PACK. What do I search for when looking for BLANK records?
>
>Hi Matt... thanks for the code... here is my code... it is in a ADD RECORD button Clicked event. I am trying to add blank records to a GRID. If the GRID
>has Deleted records, I am trying to use those up...something is wrong, because
>it will not use the deleted records as the new blank record... will you look at this code?
>thanks again...rob
>
>
>
>found_one = .f.
>rec=0
>do while !eof()
>
> if empty(name)
> dele
> endif
>
> if deleted()
> recall
> store .t. to found_one
> rec=recno()
> exit
> endif
>
> skip 1
>enddo
>
>if found_one = .f.
> append blank
> thisform.grid1.column1.text1.setfocus
>endif
>
>if found_one = .t.
> goto rec
> thisform.grid1.column1.text1.setfocus
>endif
>
>*thisform.grid1.refresh()

The "do while not eof()" is going to be a drag on performance. Why not just search for one record since you are only adding one record? Maybe some thing like this...

*SAVE CURRENT "SET DELETE" STATE
STORE SET("DELETE") TO DELE_STATE
*TURN IT OFF
SET DELE OFF


*SAVE CURRENT INDEX ORDER
STORE ORDER() TO M.ORDER_STATE
*TURN IT OFF
SET ORDER TO 0

LOCA FOR DELETED() OR EMPTY(NAME)

IF NOT FOUND()
APPEND BLANK
ELSE
RECALL
ENDIF

THISFORM.GRID1.COLUMN1.SETFOCUS

*RESTORE "SET DELETE" STATE
SET DELE &DELE_STATE

*RESTORE INDEX ORDER
IF NOT EMPTY(M.ORDER_STATE)
SET ORDER TO (M.ORDER_STATE)
ENDIF
L.A.Long
ProgRes
lalong1@charter.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform