Q58042: QCARDS Demo Program Incorrectly Searches for Zip Code
Article: Q58042
Product(s): See article
Version(s): 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S900118-77 buglist4.50 | mspl13_basic
Last Modified: 31-JAN-1990
The QCARDS.BAS demo program shipped with Microsoft QuickBASIC Version
4.50 does not search correctly for zip codes. When searching for only
a zip code, all cards will match; when searching for zip code and some
other field, no cards are found.
To correct this problem, change the following lines from near the end
of the FindCard FUNCTION in QCARDS.BAS as indicated:
' Test zip code.
SELECT CASE TmpCard.Zip '**** change to RTRIM$(UCASE$(...))
CASE "", RTRIM$(UCASE$(Index(Card).Zip))
Found = Found + 1
CASE ELSE
END SELECT
' If match is found, set function value and quit, else next card.
IF Found = NFIELDS - 1 THEN '**** remove "- 1" after NFIELDS
FindCard% = Card
EXIT FUNCTION
END IF
The altered code is as follows:
' Test zip code.
SELECT CASE RTRIM$(UCASE$(TmpCard.Zip)) '****
CASE "", RTRIM$(UCASE$(Index(Card).Zip))
Found = Found + 1
CASE ELSE
END SELECT
' If match is found, set function value and quit, else next card.
IF Found = NFIELDS THEN '****
FindCard% = Card
EXIT FUNCTION
END IF
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.