<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_SetSoftSeek |
Declare Sub sx_SetSoftSeek Lib "Apollo9.dll"
(ByVal uiOnOff As Integer)
VOID FAR PASCAL sx_SetSoftSeek
(USHORT uiOnOff);
Indicates whether or not index seeks that result in failure (i.e., the requested key value does not match any key in the index order either partially or exactly) should result in a successful conclusion if a key is found that is immediately greater than the requested key.
uiOnOff: If True, then soft seeks are performed for all files in the current task. The soft seek setting is global in this respect. sx_SetSoftSeek is normally only turned on when necessary, and then turned off immediately after performing sx_Seek. See sx_Seek for details as to its behavior when sx_SetSoftSeek is set to True.
Note: This is a global system setting that affects all index seeks once it is turned on.
Sub ButtonSeek_Click ()
RecStr$ = InputBox$("Seek Key?", "Seek", "")
If RecStr$ = "" Then Exit Sub
RecStr$ = UCase$(RecStr$)
sx_SetSoftSeek True
If sx_Seek(RecStr$) Then
If sx_Found() Then
MsgBox "Exact or partial match!"
Else
MsgBox "Soft seek - on record after"
End If
Call sx_GetRecord(lRec)
BoxCust.Text = lRec.lCust
Else
MsgBox "Key Not Found"
ButtonTop_Click
End If
sx_SetSoftSeek False
End Sub
sx_SetSoftSeek(TRUE);
if (sx_Seek(cpSeekKey))
{
if (sx_Found())
AfxMessageBox((LPCSTR) "Exact or partial match.");
else
AfxMessageBox((LPCSTR) "Soft seek - on record after.");
sx_GetRecord(lRec);
}
else
AfxMessageBox((LPCSTR) "Key not found.");
sx_SetSoftSeek(FALSE);
sx_Seek, sx_SeekBin, sx_SetExact