devmanning
New Member
- Joined
- Aug 25, 2011
- Messages
- 1
Hi I have a local SQL server and using Excel VBA 2010 I am passing a sql query to retreive data but it comes with an error saying "Invalid Object Name outlet_master", where outlet_master is the table, residing within the master DB of SQL server I am referencing to.
I have opened the connection as follows:
objMyConn.Open "Provider=SQLOLEDB;" _
& "Data Source =dev-PC\sqlserver;" _
& "Initial Catalog = master;" _
& "Integrated Security=SSPI;"
in The command object:
objMycmd.ActiveConnection = objMyConn
objMycmd.CommandText = "Select * From Outlet_master"
objMycmd.CommandType = adCmdText
In the Recordset section
Set objMyRecordset = objMycmd.Execute
When I run this part of the section (Recordset), I enounter the above error.
Could some one let me know what is the issue with the code. I will appreciate your feedback
Cheers,
Dev
I have opened the connection as follows:
objMyConn.Open "Provider=SQLOLEDB;" _
& "Data Source =dev-PC\sqlserver;" _
& "Initial Catalog = master;" _
& "Integrated Security=SSPI;"
in The command object:
objMycmd.ActiveConnection = objMyConn
objMycmd.CommandText = "Select * From Outlet_master"
objMycmd.CommandType = adCmdText
In the Recordset section
Set objMyRecordset = objMycmd.Execute
When I run this part of the section (Recordset), I enounter the above error.
Could some one let me know what is the issue with the code. I will appreciate your feedback
Cheers,
Dev