Solved

Data Type of Character in FoxPro and VB datatype

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 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