FIX: LOOKUP() Function Returns "Data Type Mismatch"Last reviewed: March 6, 1996Article ID: Q147780 |
The information in this article applies to:
SYMPTOMSWhen you use the LOOKUP function to search for information, the error "Data Type Mismatch" will occur if there is a filter set on the table and an index does not exist on the searched field. The filter can be set to any field, but if an index has not been created for the field that the LOOKUP function is searching, the error will occur.
WORKAROUNDIndex the field that is to be searched before using the LOOKUP function.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual FoxPro 3.0 for Windows.
MORE INFORMATION
Steps to Reproduce ProblemPlace the following code into a program:
CREATE TABLE test (city c(10)) INSERT INTO test (city) VALUES ("NEW YORK") INSERT INTO test (city) VALUES ("SEATTLE") INSERT INTO test (city) VALUES ("DENVER") INSERT INTO test (city) VALUES ("CHARLOTTE") SET FILTER TO city = "NEW YORK" ? LOOKUP(Test.city, "NEW YORK", Test.city)Run the program, and note that the error "Data Type Mismatch" occurs. Add the following line of code before the LOOKUP function:
INDEX ON city TAG cityNow the LOOKUP function will work correctly. The index on the search field will also help find records faster when you use the LOOKUP() function. Also please note that if there is no index, the LOOKUP() function will locate deleted records even though SET DELETED is ON. For more information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q122511 TITLE : BUG: LOOKUP() Locates Deleted Records |
Additional reference words: 2.60 2.60a FoxWin buglist2.60 buglist2.60a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |