Error Message Variable and Procedure instead of Module

Joined
Feb 15, 2008
Messages
5
Reaction score
0
Hi,

I'm really new to Access and VBA. Right now I find it quite frustrating to get error messages which I don't understand.

In a form I have a button for which I wrote some code:

Private Sub Befehl16_Click()
If IsNull(Artist) Then Exit Sub
Biography Artist



Public Sub Biography(curArtist As String)
Dim conn As ADODB.Connection
Dim rst As New ADODB.Recordset
Set conn = CurrentProject.Connection

rst.Open "SELECT Artist FROM Artist_Information WHERE Artist = " & curArtist, conn, adOpenForwardOnly, adLockReadOnly

While Not rst.EOF
curArtist = rst.Fields(0)
If curArtist = "Anna Ternheim" Then
MsgBox ("Artist Biography: Anna Ternheim was born in Sweden in 1976.")
End If
rst.MoveNext
Wend
'rst.Close
End Sub


Now I get the following message:

"Variable or Procedure expected instead of Module"

The debugger is referring to the Biography procedure. I don't understand, because Biography is in fact a procdure written in a module. So what is Access expecting here?



Thanks a lot,
Annika
 
Last edited:
Joined
Feb 15, 2008
Messages
5
Reaction score
0
Hi,


ok, I named the module the same as the procedure....unfortunately this wasn't stated in the error message...that's why my programme did not find the procedure but the module...!

Cheers,
Annika
 

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