Solved

Data Type of Character in FoxPro and VB datatype

Posted on 2000-04-13
4
226 Views
Last Modified: 2013-12-03
My program code,

objCms.Find "code = " & strCode

objcms is recordset reading from FoxPro dbf file. "code" field in dbf table is characters(6) datatype. And strCode in VB is string datatype. The system gives an error message saying "Type mismatch..". How can I solve this type mismatch problem?
0
Comment
Question by:kennethan
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Dxpert
ID: 2714410
Are you sure that the Data Type for the field "CODE" is "Character", it seems to me that it is a "Numeric" field.
0
 
LVL 10

Expert Comment

by:Dxpert
ID: 2714419
..also, just make sure that strCode is a character string.
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 20 total points
ID: 2715173
dxpert, you are on the right lines but I don't think you made yourself clear;

objCms.Find "code = " & strCode

will fail when searching a character field.

objCms.Find "code = '" & strCode & "'"

will succeed.

The problem being that unless you surround the string to be matched in quotes, it is interpreted as a non-character value this is what gives rise to the error.
0
 

Author Comment

by:kennethan
ID: 2716563
Adjusted points from 15 to 20
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now