Creating custom property

  • Thread starter Thread starter Jorge Ribeiro
  • Start date Start date
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
 
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.
 
Back
Top