INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

type mismatch error

type mismatch error

(OP)
Hello all.

I am getting a mismatch and not sure as to why.

CODE

id = request.form("id")

v_their_damaged = request.form("their_damaged")
v_their_good = request.form("their_good")
v_their_flawless = request.form("their_flawless")
v_our_damaged = request.form("our_damaged")
v_us_good = request.form("us_good")
v_us_flawless = request.form("us_flawless") 

set check1 = conn.execute("select id, usdamaged_, usused, usflawless from pricing where id = "&id&"")
	var1 = check1.fields.item("usdamaged_").value
	var2 = check1.fields.item("usused").value
	var3 = check1.fields.item("usflawless").value
	
		if v_their_damaged <> var1 or v_their_good <> var2 or v_their_flawless <> var3 then
			strSQL = "update pricing set usdamaged_ = "&v_our_damaged&" where id = "&id&""
			conn.execute (strSQL)
			
			strSQL = "update pricing set usused = "&v_us_good&" where id = "&id&""
			conn.execute (strSQL)
			
			strSQL = "update pricing set usflawless = "&v_us_flawless&" where id = "&id&""
			conn.execute (strSQL)

		else 

the database fields for all of these are decimal 5,2. the form these are coming from are from the same table.
Since they are pulled from the same table and the fields are all decimal 5,2 why woulod this be happening?

RE: type mismatch error

Which line gets the error? What are the values of the variables at the time of the error?

You can add some error trapping, like this:

CODE

strSQL = "update pricing set usdamaged_ = "&v_our_damaged&" where id = "&id&""
On Error Resume Next
conn.execute (strSQL)
If Err.Number <> 0 Then 
   response.write "Err#" & Err.Number & ": " & Err.Description & "<br>" & strSQL
   response.end
End If
On Error Goto 0 

RE: type mismatch error

(OP)
SORRY FOR NOT POSTING THE LINE:

CODE

if v_their_damaged <> var1 or v_their_good <> var2 or v_their_flawless <> var3 then 

I will add the trapping as you suggested.

What I did to make this work is format the numbers to a two digit decimal for all of the numbers once I called them from the DB table.
I am not sure why this was necessary but it did work. But thanks for the reply and the idea to trap the error.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close