Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146

    Angry Unanswered: Compile error: only comments may appear after End Sub, End Function, or End Property

    Hi,

    I'm using Access 2007, and i don't know if the problem is related to that.
    I'm trying to get the username logged on to the network using the following code:

    Public Declare Function Lib "advapi32" Alias "GetUserNameA" (ByVal lpBuffer as String, nSize as Long) as Long

    Function GetUser() as string
    ....the rest of the code...
    End Function

    If i compile the code, an error appear at the "Public Declare Function...", that says: "Compile error: Only comments may appear after End Sub, End Function or End Property"

    Can anyone help me with this!?

    Thanks!

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Check ...the rest of the code... for an errant End Function statement.

    Also, is that the only function in your entire module?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146

    Talking

    Thanks for your reply.

    I've arranje to manage the problem. I'm so naif... i was putting the declare function right before the statement Function, and not in the begining of the module. The problem is that the VB should tell us the error as it is and not referring to an error that was not the case.

  4. #4
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    The erro message was accurate - no offense
    Dale Houston, TX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •