Solved

Data Type of Character in FoxPro and VB datatype

Posted on 2000-04-13
4
225 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 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

23 Experts available now in Live!

Get 1:1 Help Now