Calling a function from a button on a form

G

Guest

I have the following function which is part of a module (modPerformance_PC)
which I would like to call using the on Click event of a button on a form.
However, when I use the button I get a message :Ambiguous name detected:
Del_performance_PC".

Here is the code for the function

Public Function Del_Performance_PC()
Dim msg As String
Dim Title As String
Dim response As String
stDelete = "DELETE Performance_PC.* From Performance_PC "
msg = "You are about to DELETE all records from Performance_PC!... Continue?"
Title = "Warning!"
response = MsgBox(msg, vbYesNo, Title)
If response = 7 Then
Exit Function
End If
CurrentDb.Execute stDelete
stDelete = "DELETE Performance_PC.* From All_Growth_Adjusted "
CurrentDb.Execute stDelete
MsgBox ("All Records Successfully Deleted From PC_Performance & All Growth
Adjusted")
End Function

The code associated with teh button is

Private Sub Command1_Click()
Del_Performance_PC
End Sub
 
J

Jeff Boyce

Rafi

The error message suggests that Access can't tell which copy of
"Del_performance_PC" it should use. The impllication is that there is more
than one...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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