Creating custom property

J

Jorge Ribeiro

Hello

I've an access db that has several custom properties defined.
In a form's button click event i must open another access db and create a
different
custom property in that newly oppened database.

My code is:

Dim DB As database
Dim prop As Property
Set DB = OpenDatabase(destFile)
Set prop =
DB.Containers("Databases").Documents("UserDefined").CreateProperty(ProjectIdTag, DB_TEXT, primaryKey)
DB.Containers("Databases").Documents("UserDefined").Properties.Append prop
DB.Close

It seems the right code but when i do DB.close it does not save my new
property.
If i remove DB.Close the property is saved.

After that piece of code i open the file in destFile with access and close
the current application.
This is to be done in order to open the updated file closing the former.
It does not report any error but the custom property is not saved.

Can you help me here? I'm running out of ideas

thankx

Jorge
 
D

Dale Fye

Jorge,

Although I have not tried this, you might consider putting some small time
delay between the Append line and the db.Close line.

I've experienced similar situations when I created a file, but it did not
show up immediately when I used the DIR( ) function. I found that inserting
a pause(.5) in the code seemed to give the application time to process the
previous action.

Public Sub Pause(Seconds As Double)

Dim MyTimer As Long

MyTimer = Timer
While Timer - MyTimer < Seconds
DoEvents
Wend

End Sub

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top