Solved

Access 2003/2007 and iSeries ODBC

Posted on 2013-06-21
15
376 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:Kdo
Comment Utility
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
Comment Utility
Hi,

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

Regards,

Bill
0
 

Author Comment

by:ParisBP
Comment Utility
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
 
LVL 14

Expert Comment

by:Bill Ross
Comment Utility
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
Comment Utility
Clng changes in the make-table didn't work.  Using delete/append methodology also failed.
0
 
LVL 14

Expert Comment

by:Bill Ross
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:ParisBP
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
OK...will deconstruct/reconstruct and see where that takes us...
0
 

Author Comment

by:ParisBP
Comment Utility
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
Comment Utility
Great!!!

Let me know if I can help further...

Bill
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

771 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

10 Experts available now in Live!

Get 1:1 Help Now