I am tring to create a db via code. When I use the code sniplet from MS, I get the following error:<br>
<br>
The Microsoft Jet database engine cannot open the file <name>.<br>
It is already opened exclusively by another user, or you need<br>
permission to view its data. (Error 3051)<br>
<br>
The code that I am using is listed below:<br>
<br>
'If previous database file exists, then delete it<br>
strCheckFileName = Dir(FileName)<br>
If strCheckFileName <> "" Then<br>
Kill FileName<br>
End If<br>
<br>
'Create the database<br>
Set WS = DBEngine.Workspaces(0)<br>
Set DB = WS.CreateDatabase(FileName, _<br>
dbLangGeneral) 'VB breaks on this line.<br>
<br>
The help file for this error says that someone else may be using the database and therefore cannot open the file. However, since the file does not and has never existed (and even if it did, it would have been deleted), how is this possible?<br>
<br>
What am I missing????
<br>
The Microsoft Jet database engine cannot open the file <name>.<br>
It is already opened exclusively by another user, or you need<br>
permission to view its data. (Error 3051)<br>
<br>
The code that I am using is listed below:<br>
<br>
'If previous database file exists, then delete it<br>
strCheckFileName = Dir(FileName)<br>
If strCheckFileName <> "" Then<br>
Kill FileName<br>
End If<br>
<br>
'Create the database<br>
Set WS = DBEngine.Workspaces(0)<br>
Set DB = WS.CreateDatabase(FileName, _<br>
dbLangGeneral) 'VB breaks on this line.<br>
<br>
The help file for this error says that someone else may be using the database and therefore cannot open the file. However, since the file does not and has never existed (and even if it did, it would have been deleted), how is this possible?<br>
<br>
What am I missing????