Solved

Access 2003/2007 and iSeries ODBC

Posted on 2013-06-21
15
387 Views
Last Modified: 2013-06-24
We are running Access 2007.  

We are able to update an MDB format version of the database in question.

We created a new ACCDB database and imported all queries/tables/etc from the MDB.  We deleted and relinked all ODBC tables with keys defined.  

The same make-table query now bombs with an ODBC call-failed message ("SQL data type argument out of range (#30030)".

Any suggestions?
0
Comment
Question by:ParisBP
  • 8
  • 6
15 Comments
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 39268284
Hi Paris,

This kind of error is almost always on the client side, so let's look at what can cause it.

1.  Are you recreating the database on the same desktop computer that housed it previously?  If it's a different computer, what's different.

2.  What's different on the desktop computer?  Has the O/S been upgraded?  Has the O/S changed?  Are there new database utilities that may have overwritten the ODBC driver or modified the system registries regarding the driver?  Have any of the Microsoft Office products been updated?

3.  Are you connecting to the same database or a different database on the same server?

4.  Can you create a brand new Access database and link the AS400 tables from the new database?


Let's start there....
Kent
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39270800
Hi,

Please post the SQL for the make table query that is failing.

Regards,

Bill
0
 

Author Comment

by:ParisBP
ID: 39270987
1.  Same computer (running Acc2007) that currently updates the MDB version of the database.
2.  No changes to OS, driver, etc.
3.  Now connecting to an ACCDB formatted database, same server.
4.  That's what we did...created the new ACCDB object, then imported the objects from the MDB.  Connected to the iSeries tables via new ODBC linked-tables and defined keys on each one.

Maketable query is copied below.

SELECT PB3555AFPL_SRBSOH.OHCUNO, PB3555AFPL_SRBSOH.OHNAME, PB3555AFPL_SRBSOL.OLORNO, PB3555AFPL_SRBSOL.OLLINE, PB3555AFPL_SRBSOL.OLSROM, PB3555AFPL_SRBSOL.OLPRDC, PB3555AFPL_SRBSOL.OLOQTS, IIf([OLFOCC]='Y',0,[OLSCPR]) AS OLSALP, [OLOQTS]*IIf([PB3555AFPL_SRBSOL].[OLFOCC]='Y',0,[PB3555AFPL_SRBSOL].[OLSCPR]) AS Expr1, PB3555AFPL_SRBPRG.PGAPCO, DateValue(Now()-1) AS Expr4, PB3555AFPL_SRBSOL.OLDELT, PB3555AFPL_SRBSOL.OLRDDT, PB3555AFPL_SRBCTLDG.CTAGRD, PB3555AFPL_SRBSOL.OLORDT, PB3555AFPL_SRBPRG.PGAGRP, PB3555AFPL_SRBSOL.OLSTAT, PB3555AFPL_SRBSOL.OLORDS, PB3555AFPL_SRBSOL.OLBALC, PB3555AFPL_SRBSOL.OLFICC, Int([OHODAT]) AS Expr2, Int((10000*(Year(DateValue(Now()-1)))+(100*Month(DateValue(Now()-1)))+Day(DateValue(Now()-1)))) AS RunDate, PB3555AFPL_SRONAM.NAAREA, PB3555AFPL_SRBSOL.OLPOTP, [OLOQTS]*[PGAPCO] AS ExtCost, PB3555AFPL_SRBSOH.OHODAT, Left([PGAGRP],2) AS AcctBreak, Int((10000*(Year(DateValue(Now()-7)))+(100*Month(DateValue(Now()-7)))+Day(DateValue(Now()-7)))) AS RunDate2, PB3555AFPL_SRBSOH.OHSALE AS HdrSalesman, PB3555AFPL_SRBSOH.OHOREF AS CustPO INTO ASWOrderInbound
FROM (((PB3555AFPL_SRBSOL INNER JOIN PB3555AFPL_SRBSOH ON PB3555AFPL_SRBSOL.OLORNO = PB3555AFPL_SRBSOH.OHORNO) INNER JOIN PB3555AFPL_SRBPRG ON PB3555AFPL_SRBSOL.OLPRDC = PB3555AFPL_SRBPRG.PGPRDC) INNER JOIN PB3555AFPL_SRBCTLDG ON PB3555AFPL_SRBPRG.PGAGRP = PB3555AFPL_SRBCTLDG.CTAGRN) INNER JOIN PB3555AFPL_SRONAM ON PB3555AFPL_SRBSOL.OLCUNO = PB3555AFPL_SRONAM.NANUM
WHERE (((PB3555AFPL_SRBSOL.OLOQTS)>0) AND ((PB3555AFPL_SRBSOL.OLORDT) Not In ('IR','CI','CN','CR','CS')) AND ((PB3555AFPL_SRBSOL.OLSTAT)<>'D') AND ((PB3555AFPL_SRBSOL.OLFICC)<>'Y') AND ((PB3555AFPL_SRBSOH.OHODAT)>=20100101));
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 14

Expert Comment

by:Bill Ross
ID: 39271022
Hi,

I would change the following expressions in the query for return values of LONG:

CLng(Int([OHODAT])) AS Expr2

CLng(Int((10000*(Year(DateValue(Now()-1)))+(100*Month(DateValue(Now()-1)))+Day(DateValue(Now()-1))))) AS RunDate

CLng(Int((10000*(Year(DateValue(Now()-7)))+(100*Month(DateValue(Now()-7)))+Day(DateValue(Now()-7))))) AS RunDate2

The MakeTable query may be attempting to create the wrong data types in the new table.  The best way to handle this is to create a blank table with correct data types.  Run a delete query to clear the table then an append query to add the data.

Using a MakeTable requires the query generator to figure out the desired data types.

I suspect the query optimizer works differently in 2003 vs. 2007.

Regards,

Bill
0
 

Author Comment

by:ParisBP
ID: 39271049
Clng changes in the make-table didn't work.  Using delete/append methodology also failed.
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39271087
Hi,

OK.

Make a backup of the query.

Change the Maketable query to a select query and inspect the results.  Look at each field closely and check for data that might be problematic.  

Remove the 3 computed fields and see if the make table works.  If so then the computations are problematic - if not then there is a data issue that should be seen from above.

Try and limit the result set to one record and see if the Maketable works.

We'll figure it out.

Bill
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39271094
Hi,

Additionally - I would expect the "("SQL data type argument out of range (#30030)" error to be because a date numeric value is beyond scope.  Look at very large numbers or dates before 1/1/1800, etc.

Bill
0
 

Author Comment

by:ParisBP
ID: 39271160
Took out the three fields we applied Clng to...changed to select query...failed.

Very odd...the same machine updates the same query in the MDB version every night without incident...and after doing the import of the query to a clean ACCDB, it's failing.
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39271195
Did you inspect the data for out of range values?

Did you test a single row of data?

2007 may handle values more strictly than 2003 due to integration with SQL.

Look at the result set closely...

Bill
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39271201
Did I read that right - the SELECT query fails?

If so, then delete half the fields and test.  If that fails the delete another half.  Find the one or more fields that have bad (out of range) data.

Bill
0
 

Author Comment

by:ParisBP
ID: 39271218
Yes, the select failed.  Tried pulling in only a few records (for a single sales order)...still bombed.  

2007 is able to process the same query in the MDB version without incident...so it's something with how it handles ACCDB and queries within that format.  Just doesn't make a lot of sense right now.
0
 
LVL 14

Accepted Solution

by:
Bill Ross earned 500 total points
ID: 39271372
I still believe it's a data issue as 2007 is much more restrictive than 2003 due to SharePoint and SQL integration.  For mdb's that integration is "dumbed down".

I know it's tedious but eliminate the joins and look at the nate data.  Build the query from scratch to find the issue.

Bill
0
 

Author Comment

by:ParisBP
ID: 39271385
OK...will deconstruct/reconstruct and see where that takes us...
0
 

Author Comment

by:ParisBP
ID: 39271932
Got it working....One of the tables in the query was a physical file linked to the backend.  Based on something else I saw (in comparing to another query that worked), I changed it to link to its logical file on the backend...and now it runs fine.  Didn't have any trouble with the date manipulations or substrings or IIf calculations, and the rest of the query is pretty simple.

We've got quite a few more of these to go, but now I know to check the physical/logical things first when/if the 30030's crop up.  

Thanks much for your help.
0
 
LVL 14

Expert Comment

by:Bill Ross
ID: 39272015
Great!!!

Let me know if I can help further...

Bill
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

830 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