X
xanders
Hi Arvin
I just created the table in a database (copy), but the
databases where the tables are pasted has een password!
I get a error generated when I try to activate this
syntaxis.
Do you see how I can errorless activate this function?
Question nr 2, are you Dutch? (because the name)
"
Private Sub Knop0_Click()
CopyTable
End Sub
Public Function CopyTable()
On Error Resume Next
Dim Response As Integer
Dim strPath As String
Dim strSQL As String
Dim db As dao.Database
Dim ws As dao.Workspace
Dim fInTrans As Boolean
'On Error GoTo Err_RollbackDB
fInTrans = False
Set ws = DBEngine.Workspaces(0)
strPath = "C:\Temp\Test.mdb"
Set db = ws.OpenDatabase(strPath, False, False, "aaa")
BeginTrans
On Error GoTo Err_RollbackDB
fInTrans = True
strSQL = "SELECT * INTO tbl1 IN '" & strPath & "' FROM
tbl1"
db.Execute strSQL
ws.CommitTrans ' Commit changes
RollbackDB_Exit:
DoCmd.Hourglass False
Set db = Nothing
Set ws = Nothing
Exit Function
Err_RollbackDB:
MsgBox "Errornumber: " & err.Number & ", and
description: " & err.Description, vbCritical, "ERROR"
If fInTrans Then
ws.Rollback
End If
Resume RollbackDB_Exit
End Function"
I just created the table in a database (copy), but the
databases where the tables are pasted has een password!
I get a error generated when I try to activate this
syntaxis.
Do you see how I can errorless activate this function?
Question nr 2, are you Dutch? (because the name)
"
Private Sub Knop0_Click()
CopyTable
End Sub
Public Function CopyTable()
On Error Resume Next
Dim Response As Integer
Dim strPath As String
Dim strSQL As String
Dim db As dao.Database
Dim ws As dao.Workspace
Dim fInTrans As Boolean
'On Error GoTo Err_RollbackDB
fInTrans = False
Set ws = DBEngine.Workspaces(0)
strPath = "C:\Temp\Test.mdb"
Set db = ws.OpenDatabase(strPath, False, False, "aaa")
BeginTrans
On Error GoTo Err_RollbackDB
fInTrans = True
strSQL = "SELECT * INTO tbl1 IN '" & strPath & "' FROM
tbl1"
db.Execute strSQL
ws.CommitTrans ' Commit changes
RollbackDB_Exit:
DoCmd.Hourglass False
Set db = Nothing
Set ws = Nothing
Exit Function
Err_RollbackDB:
MsgBox "Errornumber: " & err.Number & ", and
description: " & err.Description, vbCritical, "ERROR"
If fInTrans Then
ws.Rollback
End If
Resume RollbackDB_Exit
End Function"
..-----Original Message-----
The function WebDB() Copies 3 tables from the current database to the new
one within a transaction (if anything fails, it all fails). If you already
have the 2nd database built, you will not need the CreateWebDatabase()
function. All you need to do to make it work then is to supply the path for
the strPath variable.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
.