Handling "Type mismatch" error

Handling "Type mismatch" error

Post by Bill Alexande » Fri, 13 Oct 1995 04:00:00



Is there a way of having a VB application determine which field in the
database caused a "type mismatch" error?  I would like to at least put the
cursor on the offending field.  Or do I have to ensure that the text box
only accepts the correct type of data before I try to update the
database? (Which brings us back to the Access vs. VB debate...)
 
 
 

Handling "Type mismatch" error

Post by Peter Antypa » Sat, 14 Oct 1995 04:00:00



>Is there a way of having a VB application determine which field in the
>database caused a "type mismatch" error?  I would like to at least put the
>cursor on the offending field.  Or do I have to ensure that the text box
>only accepts the correct type of data before I try to update the
>database? (Which brings us back to the Access vs. VB debate...)

I think the best thing to do is validate data as it is entered. I have
written a DLL function that validates a text box input for integer and
float values. You place it in the control.KeyPress event and it filters
out all the garbage. I use the Masked Edit control for dates.

If you want to try it, I can e-mail the file to you.

--
**********************************************************************
* Peter Antypas                                                      *

**********************************************************************

 
 
 

1. "Runtime Error 13 Data Type mismatch"

I get this error from time to time when running my compiled VB app and my
app crashes.  I'm using VB 6.0,  SQLServr 2000,  MDAC 2.5 and who knows what
else.  I have error handlers in all my modules but this doesn't seem to be
trapped.  I use mainly stored procedures and I suspect it might have
something to do with errors generated by SQL that aren't handled by VB.  Can
anyone give me any advice here.  Upgrade to MDAC 2.6 or 2.7?

Thanks,
Tom H

2. Dynamic SQL, Parameter exceeds 128 characters

3. "Run-time error 13: Type Mismatch"

4. DTS Package Question

5. Spooky "Type Mismatch in Expression" problem

6. Divide by zero error encountered

7. Q: SQLForeignKeys gives "Type mismatch"

8. Generating scripts of stored procedures

9. SELECT * "TYPE MISMATCH"

10. HELP: "Type Mismatch" when opening recordset

11. Help: "Data type mismatch"

12. Handling "UNSPECIFIED ERROR"

13. "Handle is invalid" errors