Solved

Data Type of Character in FoxPro and VB datatype

Posted on 2000-04-13
4
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

696 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