![]() |
Workspace / Transactions
In order to use transactions (my macro upload data from Excel to Access), I
have to create a workspace variable, as described in the code below. Dim wrkDefault As Workspace Set wrkDefault = DBEngine.Workspaces(0) wrkDefault.BeginTrans .... wrkDefaut.CommitTrans However, whenever I try to run the macro, I get the message: "Compile Error: User-defined Type not defined". I used to think Workspace was not a user-defined type. Does anyone know why it is happening? Thanks in advance, Paulo |
Workspace / Transactions
Hi
you must set a reference to the ADO object Library (Tools, References...in the VBE) as you are not accessing an Excel object (so Excel doesn't know what Workspace is and assumes it is a user defined type). regards Paul On May 1, 9:33 am, Paulo wrote: In order to use transactions (my macro upload data from Excel to Access), I have to create a workspace variable, as described in the code below. Dim wrkDefault As Workspace Set wrkDefault = DBEngine.Workspaces(0) wrkDefault.BeginTrans ... wrkDefaut.CommitTrans However, whenever I try to run the macro, I get the message: "Compile Error: User-defined Type not defined". I used to think Workspace was not a user-defined type. Does anyone know why it is happening? Thanks in advance, Paulo |
Workspace / Transactions
Thanks, but could you please tell the exact name of the reference? I have
tried some, but they have not worked. Thanks in advance. Paulo " wrote: Hi you must set a reference to the ADO object Library (Tools, References...in the VBE) as you are not accessing an Excel object (so Excel doesn't know what Workspace is and assumes it is a user defined type). regards Paul On May 1, 9:33 am, Paulo wrote: In order to use transactions (my macro upload data from Excel to Access), I have to create a workspace variable, as described in the code below. Dim wrkDefault As Workspace Set wrkDefault = DBEngine.Workspaces(0) wrkDefault.BeginTrans ... wrkDefaut.CommitTrans However, whenever I try to run the macro, I get the message: "Compile Error: User-defined Type not defined". I used to think Workspace was not a user-defined type. Does anyone know why it is happening? Thanks in advance, Paulo |
Workspace / Transactions
Hi
I don't know DB stuff much, but try MicroSoft DAO object library instead of AD0. On May 1, 10:12 am, Paulo wrote: Thanks, but could you please tell the exact name of the reference? I have tried some, but they have not worked. Thanks in advance. Paulo " wrote: Hi you must set a reference to the ADO object Library (Tools, References...in the VBE) as you are not accessing an Excel object (so Excel doesn't know what Workspace is and assumes it is a user defined type). regards Paul On May 1, 9:33 am, Paulo wrote: In order to use transactions (my macro upload data from Excel to Access), I have to create a workspace variable, as described in the code below. Dim wrkDefault As Workspace Set wrkDefault = DBEngine.Workspaces(0) wrkDefault.BeginTrans ... wrkDefaut.CommitTrans However, whenever I try to run the macro, I get the message: "Compile Error: User-defined Type not defined". I used to think Workspace was not a user-defined type. Does anyone know why it is happening? Thanks in advance, Paulo- Hide quoted text - - Show quoted text - |
All times are GMT +1. The time now is 11:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com