473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VBA code false "rst.FindFist strSearch"

Dear reader,

I have the following code:

StrSearch = "[Employee_code] = " & strUser & ""

Employee_code is a text field with a numeric value like 41001

strUser has also a numeric value.

The next code results in an error message

Rst.FindFirst strSearch

The error message is "Data type mismatch in criteria expression".

How can I force that both are of the same data type.

Thanks for any help,

Simon
Oct 19 '06 #1
2 3142

Simon wrote:
Dear reader,

I have the following code:

StrSearch = "[Employee_code] = " & strUser & ""

Employee_code is a text field with a numeric value like 41001
CONST cQUOTE As String = "'" '(single quote within double quotes)

strSearch = '[Employee_code] = cQUOTE & strUser & cQUOTE

Oct 19 '06 #2
"Simon" <Sv********@Versatel.nlwrote in message
<45***********************@news.tele2.nl>:
Dear reader,

I have the following code:

StrSearch = "[Employee_code] = " & strUser & ""

Employee_code is a text field with a numeric value like 41001

strUser has also a numeric value.

The next code results in an error message

Rst.FindFirst strSearch

The error message is "Data type mismatch in criteria expression".

How can I force that both are of the same data type.

Thanks for any help,

Simon
Criterion on text fields need text delimiters. Try;

StrSearch = "[Employee_code] = '" & strUser & "'"

--
Roy-Vidar
Oct 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
3
by: MLH | last post by:
I have a block of text with about 19,000 characters - alphanumeric, punctuation, hard returns, etc... I would like to count the number of periods ( Chr$(46) ) appearing in the document. Whats a...
4
by: Max | last post by:
Hello everyone, and thank you in advance for all of your help! I have a tblPrint table in Access 2002. Its structure is as follows: tblPrint ------------------ Name, Text Address1, Text...
5
by: eliffman | last post by:
I'm trying to populate an array with the records from a recordset. But I'm getting an error. Here's the code: Dim db As Database, qd As QueryDef, rs As Recordset Dim MyArray() As Double, i As...
19
by: Lauren Wilson | last post by:
A2K app: Question: is the flagged line (<<<) below necessary. If that line is needed, what effect does it have (if any) on the fact that the very same database is the linked back end db? ...
13
by: royaltiger | last post by:
I am trying to copy the inventory database in Building Access Applications by John L Viescas but when i try to run the database i get an error in the orders form when i click on the allocate...
3
by: Twanne | last post by:
Hi, I've got a table called Aerosol and a table called LinkTabel. Now I do an update to a table from an excell sheet, this table is called ExportAerosol. So far so good, the import works...
10
by: nspader | last post by:
I want to start out saying I am a novice code writer. I am trying to send a report via email based on each supplier. The code below is what I am using. I need to base recordset on Form, report...
4
by: Constantine AI | last post by:
I am trying to code a SAVE button which will automatically change numerous rows of data within a table. I have created the appropriate query and checked it works when the form is open. However the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.