Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO & DAO

Status
Not open for further replies.

NW

Programmer
Feb 3, 2000
61
GB
Can anyone tell me what's wrong/missing with my coding please? Every time this runs, program terminates with following error message.
Thanks in advance.

Run-time error 3028
Can't start your application. The workgroup information file is missing or opened exclusively by another user.

'###
'Code to create an Access(97) table using DAO and ADO to open it
'###

Dim SysDB As Database
Dim SysTB As TableDef
Dim SysFD As Field

Set SysDB = CreateDatabase("C:\test.MDB", dbLangGeneral & ";UserID=Admin;pwd=pwd")

Set SysTB = SysDB.CreateTableDef("Tb1")

With SysTB
.Fields.Append .CreateField("Field1", dbText, 8)
.Fields("Field_FormID").AllowZeroLength = True
End With
SysDB.TableDefs.Append SysTB

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = & _
"Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;" & _
"Data Source=c:\Test.mdb;" & _
"Pwd=MMG"
cn.Open

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Tb1", cn, adOpenKeyset, adLockOptimistic, adCmdTable

Set frmMain.Adodc1.Recordset = rs
 
Hi NW,

As a guess I would say the DAO Database object is locking ADO from accessing your database, try adding the line:
'SysDB.close' in your code to close the DAO Database object.

e.g.

SysDB.TableDefs.Append SysTB
SysDB.close

Hope it helps,

Codefish

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top