Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to search record in buffer?
Message
From
28/10/2003 02:46:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/10/2003 17:42:09
Mike Sontillano
Travellers Life Assurance of the Philipp
Naga, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00842961
Message ID:
00843393
Views:
26
>Hi Cetin!
>
>What I mean is to search a record that are not save yet. here is the scenario: I have a data entry of delivery receipt wherein a delivery receipt detail have a various serial number to be entered(one-to-many relationship), to avoid duplication of serial number(in child table), i have to check it in dbf and in buffer, i used optimistic table buffering. Please help.. thanks!
>
>Mike

Still not clear. Anyway as I said xbase commands work in buffered tables. You can use seek, indexseek, locate etc etc.

ie:
-You're on a row and user entered new record data and a new serial number.
-BEFORE leaving the row you can use IndexSeek to see if it's a duplicate.
if indexseek(newserialnumber, .f., 'myAlias','serialtag')
 messagebox('This serialnumber already exists')
endif
Remember you can use IndexSeek this way till you leave the row once. Any pointer movement causes IndexSeek() to return .T. even if that's not a duplicate but the serial you just entered.

If for any reason you can't use IndexSeek and your serial is not a primary key (otherwise you'd get violation error) you might use seek, locate as well. ie:

lnSerial = serialnumber && This is new record
lnRecno = recno()

locate for serialnumber = lnSerial and recno() # lnRecno
llExists = !eof()

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform