Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access SQL stored procedure error

Posted on 2014-11-14
7
Medium Priority
?
310 Views
Last Modified: 2014-11-19
I have an Access 2007 app that updates a field on a SQL table using a SQL stored procedure.

On one users PC they get "Error 13 Type Mismatch". I tried logging in as them on my PC and it works fine.

I'm using a DSN less connection string could this be the issue? e.g.
Const strCon = "Provider=SQLOLEDB.1;Data Source=MYSERVER;Initial Catalog=MYDB;User Id=User;Password=Password"
0
Comment
Question by:HKFuey
  • 3
  • 3
7 Comments
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 40442136
The stored procedure receives any parameter?
0
 
LVL 36

Expert Comment

by:ste5an
ID: 40442164
A type mismatch error occurs when you rely on implicit converts. Thus a string is as assigned to a number, but the content is not one. The first candidate are different regional and date/time settings. Access/VBA can only handle US date in a save manner. Another problem may be different thousand separator and comma settings.

And last, but not least, an user input is used without validation. And the user has entered invalid data.
0
 

Accepted Solution

by:
HKFuey earned 0 total points
ID: 40442276
Complete Red Herring this one. I thought it was failing on the SP but it actually failed on the bit where I check the form fields are filled in! (If field ="" then exit..)
I removed the checking and it works.

Not sure why it worked on my full Access but not on a users runtime version?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 36

Expert Comment

by:ste5an
ID: 40442506
What does field refer to? It may contain NULL or StringEmpty for different reasons.
0
 

Author Comment

by:HKFuey
ID: 40442583
All I'm doing is:-
if isnull(field) or field ="" then
msgbox "Blah"
exit sub
End if

Changed to this and it works fine, not sure why?

If Len(Me!TxtCustPO) = 0 Then
MsgBox "Enter PO number!"
Exit Sub
End If
If IsNull(Me!TxtCustPO) Then
MsgBox "Enter PO number!"
Exit Sub
End If
0
 
LVL 36

Assisted Solution

by:ste5an
ste5an earned 1500 total points
ID: 40442680
NULL and empty string are different.

Thus the good 'ol (field & "") = "" or Len(field & "") > 0 test. Cause even when field is NULL adding an emptry string will give you always an empty string.
0
 

Author Closing Comment

by:HKFuey
ID: 40451917
Thanks.

This normally works for me, must be because it's Friday
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question