runtime error 13- type mismatch

D

DylanN

I have been trying unsuccessfully for the past coupla' hours to figure out
this error
I've changed data types in the tables and the form to no avail..
Does anyone have a solution to troubleshoot this error...
Option Compare Database
Option Explicit


Private Sub Command29_Click()


Dim db As Database
Dim recset As Recordset
Dim amount As Single
Dim qty As Single
Dim cost As Currency
Dim sum As String


On Error GoTo Errhandler

Set recset = CurrentDb.OpenRecordset("SELECT * FROM MEDICINE")

recset.MoveFirst

While Not recset
sum = 0
amount = 0
qty = recset!Field("MED_ONHAND")
cost = recset!Field("MED_UNITPRICE")
amount = qty * cost
sum = sum + amount
recset.MoveFirst
Wend

MsgBox ("Value of medicine on hand = $" & sum)

Errhandler:
MsgBox ("Error in Process '" + Error(Err) + "'" + qty + " " +
cost)
recset.Close

Exit Sub

End Sub
 
G

Gordon Bentley-Mix

Dylan,

Have you tried stepping the code using F8 to see which line throws the
error? This might make it easier to narrow down the cause.
--
Cheers!

Gordon Bentley-Mix
Word MVP

Please post all follow-ups to the newsgroup.

Read the original version of this post in the Office Discussion Groups - no
membership required!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top