Autoexec problem in access 2007

Danielf

Registered User.
Local time
Today, 23:12
Joined
Feb 21, 2000
Messages
103
Hi,

I had in access 2003 the following macro in the autoexec module:

Function copy database()

Dim fso As Object
Set fso = CreateObject("Scripting.FilesystemObject")
Application.Echo True, _
"Copy of the database is made."
fso.copyfile Application.CurrentDb.NAME, _
Application.CurrentDb.NAME & "bak", True
Application.Echo True, ""
End Function

The purpose is to make a copy of the current database when opening access. It worked in access 2003 but it doesn't work in access 2007.

Why?

Any suggestion please?

Thanks

Daniel
 
Your function worked in my A2k7 database but I had to make a couple of changes:

1. Add Public before the function and remove the space from between copy and database: Public Function copydatabase()

2. I added to my autoexec with the RunCode and set copydatabase() as the function to run.

It ran just fine in my autoexec and created the copy when opened.
 
Hi Bob,

Thanks, it works

Have a nice day

Daniel
 

Users who are viewing this thread

Back
Top Bottom