Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with MAS90/Excel ODBC connector, Run-Time error '3146'

Status
Not open for further replies.

afarinpour

IS-IT--Management
Dec 16, 2005
2
0
0
US
I'm working with MAS90 ver9.0 (not the SQL version) and am trying to pull data from three tables use the data to populate a Excel Worksheet. Below is the code I am using;

Private Sub cmdForcast2005_Click()

'Variable settings
Dim ws As Workspace
Dim MAS90db As DAO.Database
Dim MAS90im As DAO.Recordset
Dim MAS90arn As DAO.Recordset
Dim MAS90aro As DAO.Recordset
Dim sqlIM As String
Dim sqlARN As String
Dim sqlARO As String

'Create a default workspace Object
Set ws = CreateWorkspace("", "", "", dbUseODBC)

'Create a Database object
Set MAS90db = ws.OpenDatabase("ODBC;DSN=SOTAMAS90;Company='Valrhona(001)';UID='arya';password='hunter'")

'Create a Recordset object
'ARN table - holds invoice information
sqlARN = "SELECT * FROM ARN_InvHistoryHeader"
Set MAS90arn = MAS90db.OpenRecordset(sqlARN)
'ARO table - holds invoice detail
sqlARO = "SELECT * FROM ARO_InvHistoryDetail"
Set MAS90aro = MAS90db.OpenRecordset(sqlARO)
'IM Master Table - holds item weight
sqlIM = "SELECT * FROM IM_90_UDF_IMMasterfile"
Set MAS90im = MAS90db.OpenRecordset(sqlIM)


For i = 6 To 20
loc1 = "D" & i
loc2 = "C" & i
Range(loc1).Value = MAS90im!Weight
Range(loc2).Value = MAS90im!ItemNumber
MAS90im.MoveNext
Next i

End Sub

Whan I run the code I get a Run-Time error '3146' ODBC call faild. Code stops at the MAS90im.MoveNext.....

Anyone have an idea as to why this is happening?..thanks

Arya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top