I'm kinda stumped.
Things work fine on my machine, but
not on a friend's.
Here is a snap-shot:
Using Excel VBA, I want to create
an Access .mdb and a recordset
using code. I'm still in the dark
ages Access-wise, so I'm using the
DAO 3.51 Object Library.
Here is a code fragment: (..'s to hold indents)
Sub cbCREATEmdb_Click()
01.. '
02.. Dim DB1 As Database
03.. Dim RS0 As Recordset
04.. Dim MDBName as String, RSname as String
05.. '
06.. MDBname = "d:\test\test1.mdb"
07.. '
08.. ' 1. define create engine
09.. '
10.. Dim daoDBE As DAO.DBEngine <<<<< HE GETS: runtime error 429
11.. Dim daoWS As DAO.Workspace
12.. Dim daoDB As DAO.Database
13.. Dim daoTABLE As DAO.TableDef
14.. Dim myFIELD As Field
15.. Dim myINDEX As Index
16.. '
17.. ' 2. create mdb
18.. '
19.. Set daoDBE = DAO.DBEngine
20.. Set daoWS = daoDBE.Workspaces(0)
21.. Set daoDB = daoWS.CreateDatabase(MDBname,dbLangGeneral)
22.. Set DB1 = OpenDatabase(MDBname)
23.. '
24.. ' 3. create rs0
25.. '
26.. RSname = "Master"
27.. Set daoTABLE = DB1.CreateTableDef(RSname)
28.. '
29.. ' 4. create rs0 fields
30.. '
31.. daoTABLE.Fields.Append .CreateField("name", dbText)
32.. daoTABLE.Fields.Append .CreateField("ticker", dbText)
33.. daoTABLE.Fields.Append .CreateField("rs#", dbLong)
34.. '
35.. ' 4. create rs0 index
36.. '
37.. Set myINDEX = daoTABLE.CreatreIndex("PrimaryKey")
38.. Set myFIELD = myINDEX.CreateField("ticker")
39.. myIndex.Primary = True
40.. myINDEX.Fields.Append myFIELD
41.. daoTABLE.Indexes.Append myINDEX
42.. '
43.. ' 5. append rs0 to mdb
44.. '
45.. DB1.TableDefs.Append daoTABLE
46.. '
End Sub
The above works perfectly on my computer.
However, he crashes at line 10.
== runtime error 429 == activeX component can't create object
A. I've got Office Excel+Access 2003 (11.5612), and my
friend has Office Excel+Access 2002 (10.6501).
B. We both have Tools|References|Microsoft DAO 3.51 Object Library
checked.
C. We're both using XP.. he has installed SP2, but I have not.
Any ideas as to why this works on my computer, but not
on his computer????