Hi All
I have the following code that tried to connect to SQL Server via Access but doesnt work as it returns the following error "Error HRESULT E_FAIL has been returned from a call to a COM component."
Can someone tell me what im doing wrong?
Thanks
I have the following code that tried to connect to SQL Server via Access but doesnt work as it returns the following error "Error HRESULT E_FAIL has been returned from a call to a COM component."
Code:
Dim oAccess = New Access.ApplicationClass()
Dim sDBPath As String = "\\DELLCVSERVER\RedirectedFolders\shamal.samal\Desktop\AssignLeads\test2.adp"
oAccess.OpenAccessProject(sDBPath)
MsgBox(oAccess.CurrentProject.Name)
oAccess.Application.CurrentProject.OpenConnection("Data Source=DELLCVSERVER\CAPITALVISAS;Initial Catalog=CapitalVisasCRM;Integrated Security=True")
oAccess.DoCmd.RunSavedImportExport("Import-test111")
oAccess.CurrentProject.CloseConnection()
oAccess = Nothing
Can someone tell me what im doing wrong?
Thanks