RUN-TIME ERROR '13': Type Mismatch


 I am packaging an application on a winxp box (using mdac  2.7) and deploying to a win2k box (which has mdac2.7 as well). It keeps giving me "Runtime error '13': Type mismatch". THis is driving me insane..i am supposed to roll this app out in 1 month and i am totally stuck.

I am quite sure it has something to do with MDAC versioning or something cuz i am using ado 2.7 as a reference in the vb project.

Interestingly enough, if i copy the source code from the xp box and put it right on the client (win2k box) i am trying to deploy to (it has vb on it), everything works ok.

Thanx in advance for help.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

starkmanDevConnect With a Mentor Author Commented:
After explaining it with someone else, i solved my own problem. What i failed to do was include an ini settings file that contains the settings for which database/server to hook up to.

Thank you however for your responses!

Ryan ChongCommented:
Try install latest MDAC from M$ website:
make sure when you are copying values from a recordset to a string use the follow format.

strVal = "" & rsRecordSet.Fields("FieldName").Value

because if the field name contains a NULL, then you get the type mismatch error.  So first you convert these nulls to empty strings by doing "" & .  This should solve your problem.

Also use similar format if you want to do comparisons in if statements.  Otherwise you have to check if the field value is null and it is bit of work.

to check if field value is null you have to use

if (IsNull(rsRecordSet.Fields("FieldName").Value)) then
  strVal = ""
   strVal = rsRecordSet.Fields("FieldName").Value
End if

Good Luck!
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

do what i have mensioned above for all the text fields in the database which are nullable.  Specially optional fields like Address, Fax Email, etc.
A simpler was of doing this that copes with null strings is

strVal = rsRecordSet("Fieldname") & ""
starkmanDevAuthor Commented:
Thanks all for responses. I believe i have the latest MDAC (2.7), but i think the problem lies in some scripting runtime issue (scrrun.dll?). By the way i am not using the rsRecordSet.Fields("FieldName").Value convention at all because i have a class that wraps ADO(and this class has been well tested and used and runs currently in many of our production apps at work). That's why i don't believe it is even ado anymore, but some way that the app is interpreting strings. The app installs fine from the package on the client machine, but as i said above when you open it from the start menu, you get "Runtime error '13': Type Mismatch"

Argh .. I am looking for a tall building....
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
starkmanDev, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
All Courses

From novice to tech pro — start learning today.