473,802 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Type mismatch error - help please

Hi, appreciate any help with this, I can't seem to get past this error.
The Price field is a Number Data Type.

This is part of some code that is adding records to a database. The 3
lines of x_author (text data type) works fine. The error is coming at
the "rs("price" ) = tmpFld" line. I assume I don't have it defined
correctly but not quite sure how to fix it. Thanks!
=============== ============
tmpFld = Trim(x_author)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("author") = tmpFld

------->ERROR HERE!!
tmpFld = Trim(x_price)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("price") = tmpFld

Nov 29 '06 #1
2 1513
Hi,

Propably the problem is that the tmpFld variable is set to Null
i dont think a number type fiedl in the database can accept null value.

Try this, just to make sure:
replace the Null with a 0 and see if still gets out the same error. If
it does then replace this line:
rs("price") = tmpFld
with:
rs("price") = int(tmpFld)

Tell me what goes on with u.

Best Regards
Firas S Assaad

zenfor wrote:
Hi, appreciate any help with this, I can't seem to get past this error.
The Price field is a Number Data Type.

This is part of some code that is adding records to a database. The 3
lines of x_author (text data type) works fine. The error is coming at
the "rs("price" ) = tmpFld" line. I assume I don't have it defined
correctly but not quite sure how to fix it. Thanks!
=============== ============
tmpFld = Trim(x_author)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("author") = tmpFld

------->ERROR HERE!!
tmpFld = Trim(x_price)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("price") = tmpFld
Nov 30 '06 #2

"zenfor" <bu*******@east onmass.comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
Hi, appreciate any help with this, I can't seem to get past this error.
The Price field is a Number Data Type.

This is part of some code that is adding records to a database. The 3
lines of x_author (text data type) works fine. The error is coming at
the "rs("price" ) = tmpFld" line. I assume I don't have it defined
correctly but not quite sure how to fix it. Thanks!
=============== ============
tmpFld = Trim(x_author)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("author") = tmpFld

------->ERROR HERE!!
tmpFld = Trim(x_price)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("price") = tmpFld
Could you be a bit more explicit about which liine throws an error, and what
the error is? You say that the line rs("price") = tmpFld causes the error
in your preamble, but the code suggests the error is being thrown at tmpFld
= Trim(x_price).

Where does x_price get its value from? Also, why are you creating a
recordset to perform an Insert? And what type and version of database are
you using?

--
Mike Brind
Nov 30 '06 #3

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

Similar topics

4
10698
by: Laura | last post by:
Help. Below is my code. Getting Type mismatch error on the noted line. I'm trying to send an array (aryNewD) with 4 columns and x rows to a function to save all the array info into a SQL Server table via a stored procedure. Keep getting this error. Any suggestions? Code: 'ASP: if blnNewD then
1
2494
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to True. I then have an if statement to determine what to write to the screen depending on blnNoData. As long as the if statement is true (doesn't have to go to the else clause), the code runs fine. Otherwise, a type mismatch error is returned. In...
4
11967
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column 14 (STDCOST). ---End Error Msg--- The STDCOST is set to decimal (28,14) and is a formatted in Access as a number, single with 14 decimal. I don't know why I would be getting a Type
19
8387
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without FOR UPDATE, it is fine and no error. I also tried Set objRs = objConn.Execute("SELECT * FROM EMP UPDATE OF EMPNO"), but it still couldn't help. any ideas? I tried to search in the web but couldn't find similar
2
1941
by: Rehan | last post by:
Hi there! Please help me out here. I am an inch away from completing my assignment. I am very new to VBA but i have very less time to be efficient at it. I am getting a type mismatch error when i click the button whose code is:
2
9008
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application. -------------------------------------------------------------------------------- Data type mismatch in criteria expression.
3
1727
by: Nepenthen | last post by:
Hello – I am still new to Access and I am currently working on debugging some code. I have a form with the following: Employee Name (combo with select all choice) Task (combo with select all choice) Begin date (txt) End Date (txt) Both of the combo boxes are pulling from separate union queries
19
5548
by: zz12 | last post by:
Hello, is there a setting in IIS 5.0 that would quickly fix the following error?: Microsoft VBScript runtime (0x800A000D) Type mismatch It's strange because some of our .asp pages were working fine for the past years but recently our website was updated in that old folders were renamed and the new ones took on the existing name and was wondering why some our ..asp pages are now returning this error? I would think that since the code
1
1760
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: _________________________________________________________________ Private Mint As Integer
1
1589
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: __________________________________________________ _______________Private Mint As Integer Dim date1 As Date Dim date2 As Date Dim myApplicationRecord As Application
0
10538
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.