Code will not compile

S

Stapes

Hi

I have copied code from this website and put it on a menu button
"Backup"

http://www.mvps.org/access/api/api0026.htm

However - this line of code will not compile:

Private Declare Function apiSHFileOperation Lib "Shell32.dll" _
Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) _
As Long

The error says:

Only comments may appear after End Sub, End Function, or End Property

What am I doing wrong?

Stapes
 
S

Stefan Hoffmann

hi Stapes,
I have copied code from this website and put it on a menu button
"Backup"
The error says:
Only comments may appear after End Sub, End Function, or End Property
What am I doing wrong?
You need to copy this code into a standard module, not into a form
module or into a procedure.

So create a new module in the database window, open it and paste the
code into it.

Then use the function in your button code:

Private Sub cmdBackup_Click()

If fMakeBackup() Then
MsgBox "Success."
Else
MsgBox "Failure."
End If

End Sub


mfG
--> stefan <--
 

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