Microsoft KB Archive/58042

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


QCARDS Demo Program Incorrectly Searches for Zip Code

Article ID: 58042

Article Last Modified on 11/21/2006

This article was previously published under Q58042

SYMPTOMS

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.

STATUS

Microsoft has confirmed this to be a bug in Microsoft QuickBasic version 4.50. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

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
                


Additional query words: QuickBas buglist4.50

Keywords: KB58042