A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DAO error



 
 
Thread Tools Display Modes
  #1  
Old August 22nd, 2004, 08:00 AM
Max
external usenet poster
 
Posts: n/a
Default DAO error

The following code worked for a while and now I get an error:

Couldn't create; no modify design permission for table or query

Any Ideas.
Thanks in advance.

Max

Sub CreateOpNoteTable(strDBName)
'This creates a new table in an external database using DAO and adds the
fields

Dim dbsLogdat As Database, tdfNew As TableDef, idx As Index, fld1 As Field
Set dbsLogdat = OpenDatabase(strDBName, False, False, ";pwd=admin")
Set tdfNew =
dbsLogdat.CreateTableDef("PatientOpNoteTemp",,,";p wd=admin"))
With tdfNew
.Fields.Append .CreateField("OpNoteID", dbLong)
Set idx = .CreateIndex("OpNoteIDIndex")
Set fld1 = idx.CreateField("OpNoteID")
fld1.Attributes = dbAutoIncrField
idx.Fields.Append fld1
idx.Required = True
idx.Unique = True
idx.Primary = True
.Indexes.Append idx
.Fields.Append .CreateField("PatientID", dbLong)
.Fields.Append .CreateField("EpisodeID", dbLong)
.Fields.Append .CreateField("OpDate", dbDate)

' Append the new TableDef object to the database.
dbsLogdat.TableDefs.Append tdfNew
End With

dbsLogdat.Close

End Sub


  #2  
Old August 22nd, 2004, 09:09 AM
Max
external usenet poster
 
Posts: n/a
Default

Don't worry, I have fixed it using the following:

Set MyWs = DBEngine.Workspaces(0)
Set MyDb = MyWs.OpenDatabase(Filename, False, False, ";pwd=admin")

Max

"Max" wrote in message
...
The following code worked for a while and now I get an error:

Couldn't create; no modify design permission for table or query

Any Ideas.
Thanks in advance.

Max

Sub CreateOpNoteTable(strDBName)
'This creates a new table in an external database using DAO and adds the
fields

Dim dbsLogdat As Database, tdfNew As TableDef, idx As Index, fld1 As Field
Set dbsLogdat = OpenDatabase(strDBName, False, False, ";pwd=admin")
Set tdfNew =
dbsLogdat.CreateTableDef("PatientOpNoteTemp",,,";p wd=admin"))
With tdfNew
.Fields.Append .CreateField("OpNoteID", dbLong)
Set idx = .CreateIndex("OpNoteIDIndex")
Set fld1 = idx.CreateField("OpNoteID")
fld1.Attributes = dbAutoIncrField
idx.Fields.Append fld1
idx.Required = True
idx.Unique = True
idx.Primary = True
.Indexes.Append idx
.Fields.Append .CreateField("PatientID", dbLong)
.Fields.Append .CreateField("EpisodeID", dbLong)
.Fields.Append .CreateField("OpDate", dbDate)

' Append the new TableDef object to the database.
dbsLogdat.TableDefs.Append tdfNew
End With

dbsLogdat.Close

End Sub




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 3270 Property not found Nelson Setting Up & Running Reports 9 August 2nd, 2004 11:53 PM
Reserved Error 1517 SJH General Discussion 6 July 13th, 2004 07:25 PM
problems initiating mplay32.exe electricrainbowfish Powerpoint 8 July 8th, 2004 09:37 AM
error 3011-msaccess Lalit H Kokku New Users 1 July 6th, 2004 03:34 AM
sending error -- anyone up to challenge? Roxy Outlook Express 18 June 30th, 2004 11:01 PM


All times are GMT +1. The time now is 12:10 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.