Laura,
I'm not sure I understand what you are trying to achieve. To behin with,
so we sopeak the same language, you are not copying a database, you are
copying a table. In Access terms, a database is more or less equivalent
to (one or more) access file (mdb, mde etc.), comprising all objects in
it; a table is just one object of a database, that's why you are using
CopyObject to copy it, sprecifying object type acTable (Access VBA
constant for object type: table).
Your code below, attempts to create a property for the database file
(CurrentDb), not the new table; is this what you intended to do? In
either case, what are you trying to achieve, in plain english?
Also, your CreateProperty syntax is incorrect, missing parameters. The
syntax is (look it up in VBA help):
Set property = object.CreateProperty (name, type, value, DDL)
In your case, it would probably be:
Set prop = dbs.CreateProperty("Description", dbText, "Contacts" _
& Format(Now - Day(Now), "mmm yy"))
Still, I'm not sure what you are trying to do.
Nikos
laura said:
Nikos,
I'm researching now on how to get the property description to change as well
when the database is copied. This is what I have (which doesn't work). As
I said, I'm a great copy and paster and awful programmer
. Any advice?
Private Sub Command0_Click()
Dim dest As String
Dim dbs As Database, prop As Property
dest = "DCPDS Backup - EOM " & Format(Now - Day(Now), "mmm yy")
DoCmd.CopyObject , dest, acTable, "Current DCPDS"
Set dbs = CurrentDb
Set prop = dbs.CreateProperty
prop.Description = "Contacts" & Format(Now - Day(Now), "mmm yy")
End Sub
: