B
BillyRogers
I have some code in DAO that works fine on some of my coworkers computers but
not on others...it's not the references...I've checked. So I'm trying to
convert the code to ADO. What it does is it calls a stored procedure and
passess two parameters then it inserts the data into a table in another
database.
I'm not sure exactly how to convert this from DAO to ADO
--DAO version Works
strSQL = "Exec [GetCorpDemographics&Volume&CB] @MonthYearList='" &
MyCorpDates & "', @OrderList='" & MyCorpNums & "'"
Set qdfPassthrough = CurrentDb().QueryDefs("qryPassThru")
qdfPassthrough.Sql = strSQL
DoCmd.RunSQL "SELECT * INTO [CorpDemoVol] IN '" & AccessFilePath & "'
FROM [qryPassThru];"
--this is my attempt at an ADO version....I get an error on the last line
cmd.CommandText = "[GetCorpDemographics&Volume&CB]"
cmd.CommandType = adCmdStoredProc
cmd.CommandTimeout = 0
cmd.Parameters.Refresh
cmd.Parameters("@OrderList").Value = MyCorpNums
cmd.Parameters("@MonthYearList").Value = MyCorpDates
rst1.Open cmd
DoCmd.RunSQL "SELECT * INTO [CorpDemoVol] IN '" & AccessFilePath &
"' FROM rst1;" ' I get error message saying access doesn't recognize the
table rst1
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003
not on others...it's not the references...I've checked. So I'm trying to
convert the code to ADO. What it does is it calls a stored procedure and
passess two parameters then it inserts the data into a table in another
database.
I'm not sure exactly how to convert this from DAO to ADO
--DAO version Works
strSQL = "Exec [GetCorpDemographics&Volume&CB] @MonthYearList='" &
MyCorpDates & "', @OrderList='" & MyCorpNums & "'"
Set qdfPassthrough = CurrentDb().QueryDefs("qryPassThru")
qdfPassthrough.Sql = strSQL
DoCmd.RunSQL "SELECT * INTO [CorpDemoVol] IN '" & AccessFilePath & "'
FROM [qryPassThru];"
--this is my attempt at an ADO version....I get an error on the last line
cmd.CommandText = "[GetCorpDemographics&Volume&CB]"
cmd.CommandType = adCmdStoredProc
cmd.CommandTimeout = 0
cmd.Parameters.Refresh
cmd.Parameters("@OrderList").Value = MyCorpNums
cmd.Parameters("@MonthYearList").Value = MyCorpDates
rst1.Open cmd
DoCmd.RunSQL "SELECT * INTO [CorpDemoVol] IN '" & AccessFilePath &
"' FROM rst1;" ' I get error message saying access doesn't recognize the
table rst1
--
Billy Rogers
Dallas,TX
Currently Using SQL Server 2000, Office 2000 and Office 2003