Solved

Table Long datatype and ADO adInteger parameter datatype

Posted on 2003-11-13
2
2,324 Views
Last Modified: 2008-03-06
I must be dense today :-)

I have an Access database that I am using in SQL Server Compatible Syntax (ANSI 92) mode, not that I think this matters but I am trying to be thorough.

I have a parameterized query:
PARAMETERS ErrLogApp Text ( 255 ), ErrLogNo Long, ErrLogDesc Text ( 255 ), ErrLogMod Text ( 255 ), ErrLogProc Text ( 255 ), ErrLogUser Text ( 255 );
INSERT INTO ztblErrLog ( ErrLogApp, ErrLogNo, ErrLogDesc, ErrLogMod, ErrLogProc, ErrLogUser )
SELECT [ErrLogApp] AS F1, [ErrLogNo] AS F2, [ErrLogDesc] AS F3, [ErrLogMod] AS F4, [ErrLogProc] AS F5, [ErrLogUser] AS F6;


I have a public procedure signature:
Public Sub LogError(ByRef ErrLogMod As String, _
                    ByRef ErrLogProc As String, _
                    ByRef ErrLogNo As Long, _
                    ByRef ErrLogDesc As String, _
                    ByRef ErrLogDisp As Boolean)

inside this procedure I create / append a paramter object to my command object ...
    Set prm = cmd.CreateParameter(Name:="ErrLogNo", _
                                  Type:=adInteger, _
                                  Direction:=adParamInput, _
                                  Value:=ErrLogNo)
    cmd.Parameters.Append prm

when I execute:
    cmd.Execute , , adExecuteNoRecords

I get a "-2147217913: Datatype mismatch in criteria expression" error

I left out the rest of the code because if I skip executing the above posted parameter everything works just fine.

TIA,
Steve
0
Comment
Question by:stevbe
2 Comments
 
LVL 39

Accepted Solution

by:
stevbe earned 0 total points
ID: 9748004
It was not the code it was the query.

The query parameters MUST be in the same ordinal position as they are used in the query.

PARAMETERS ErrLogApp Text ( 255 ), ErrLogMod Text ( 255 ), ErrLogProc Text ( 255 ), ErrLogNo Long, ErrLogDesc Text ( 255 ), ErrLogUser Text ( 255 );
INSERT INTO ztblErrLog ( ErrLogApp, ErrLogMod, ErrLogProc, ErrLogNo, ErrLogDesc, ErrLogUser )
SELECT [ErrLogApp] AS F1, [ErrLogMod] AS F2, [ErrLogProc] AS F3, [ErrLogNo] AS F4, [ErrLogDesc] AS F5, [ErrLogUser] AS F6;

Steve
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Format vertical text in Access 2016 3 32
Tags from access to excel 3 28
Search Form with Run Time Error 3075 1 22
Acc 2010 pause execution 10 8
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now