We have just converted from Access 2003 to Office (Access) 2007 and I am trying to convert a script we had to ADO structure. The intent of the script is to move via form button from one databast to another.
Below is the script from "Before" and "After". The intent of the test is to move from OpenDatabase_1 to and from OpenDatabase_2 and back.
The "After" does not yield an error, but does not do anything. Any suggestions are appreciated.
Before (Access 2003)
Private Sub QuitandReturntoMaster_Click()
On Error GoTo Err_QuitandReturntoMaster_Click
' Create instance of Access Application.
Set appAccess = CreateObject("Access.Application")
'Open BP_Control Database
appAccess.OpenCurrentDatabase "\\vhapthshare\datawarehouse\PrimaryCare\CGPI\CGPI.mdb", False
DoCmd.Quit
Exit_QuitandReturntoMaster_Click:
Exit Sub
Err_QuitandReturntoMaster_Click:
MsgBox Err.Description
Resume Exit_QuitandReturntoMaster_Click
End Sub
After (Access 2007)
Private Sub Command0_Click()
'Declare openMaster as connection
Dim openMaster As ADODB.Connection
'Define connection object
Set openMaster = New ADODB.Connection
'Specify data provider
openMaster.Provider = "Microsoft.ACE.OLEDB.12.0"
'Open Master database
openMaster.Open "\\vhapthshare\datawarehouse\hb\OpenDatabase2_Test.accdb"
End Sub
Thanks in advance.
Below is the script from "Before" and "After". The intent of the test is to move from OpenDatabase_1 to and from OpenDatabase_2 and back.
The "After" does not yield an error, but does not do anything. Any suggestions are appreciated.
Before (Access 2003)
Private Sub QuitandReturntoMaster_Click()
On Error GoTo Err_QuitandReturntoMaster_Click
' Create instance of Access Application.
Set appAccess = CreateObject("Access.Application")
'Open BP_Control Database
appAccess.OpenCurrentDatabase "\\vhapthshare\datawarehouse\PrimaryCare\CGPI\CGPI.mdb", False
DoCmd.Quit
Exit_QuitandReturntoMaster_Click:
Exit Sub
Err_QuitandReturntoMaster_Click:
MsgBox Err.Description
Resume Exit_QuitandReturntoMaster_Click
End Sub
After (Access 2007)
Private Sub Command0_Click()
'Declare openMaster as connection
Dim openMaster As ADODB.Connection
'Define connection object
Set openMaster = New ADODB.Connection
'Specify data provider
openMaster.Provider = "Microsoft.ACE.OLEDB.12.0"
'Open Master database
openMaster.Open "\\vhapthshare\datawarehouse\hb\OpenDatabase2_Test.accdb"
End Sub
Thanks in advance.