T
TL
All,
I am trying to export a table from an Access 2007 database to a SQL server
2005 database. However I can not get the table to export to the correct
schema. it always goes to the dbo schema. Below is the code I am running.
When I run the table shows up in SQL as dbo.[schema.SQL_Tableusername] and I
need it to be schema.SQL_Tableuser
Any help would be helpful
Private Sub Command7_Click()
Dim db As Database
Dim username As String
Dim tablename As String
Set db = CurrentDb
username = Environ("USERNAME")
username = Replace(username, ".", "")
tablename = "" & "SQL_Table" & username & ""
On Error GoTo ErrorHandler2
DoCmd.TransferDatabase acExport, "ODBC Database", _
"ODBC;DSN=PAWCHDPARTDEV01;UID=MyUserID;PWD=MyPassword;LANGUAGE=us_english;" _
& "DATABASE=DPART_P008", acTable, "tbl_accounts", "schema." & tablename
'db.Execute (execLe10)
MsgBox "Done", vbInformation
Exit Sub
ErrorHandler1:
MsgBox "Failed1", vbInformation
ErrorHandler2:
MsgBox "Failed2", vbInformation
End Sub
I am trying to export a table from an Access 2007 database to a SQL server
2005 database. However I can not get the table to export to the correct
schema. it always goes to the dbo schema. Below is the code I am running.
When I run the table shows up in SQL as dbo.[schema.SQL_Tableusername] and I
need it to be schema.SQL_Tableuser
Any help would be helpful
Private Sub Command7_Click()
Dim db As Database
Dim username As String
Dim tablename As String
Set db = CurrentDb
username = Environ("USERNAME")
username = Replace(username, ".", "")
tablename = "" & "SQL_Table" & username & ""
On Error GoTo ErrorHandler2
DoCmd.TransferDatabase acExport, "ODBC Database", _
"ODBC;DSN=PAWCHDPARTDEV01;UID=MyUserID;PWD=MyPassword;LANGUAGE=us_english;" _
& "DATABASE=DPART_P008", acTable, "tbl_accounts", "schema." & tablename
'db.Execute (execLe10)
MsgBox "Done", vbInformation
Exit Sub
ErrorHandler1:
MsgBox "Failed1", vbInformation
ErrorHandler2:
MsgBox "Failed2", vbInformation
End Sub