Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Resolve error message "Only comments can appear after End sub etc.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NEWBIE - 31 Aug 2005 16:11 GMT
I keep getting error message "Only comments can appear after End Sub etc..."
when I try to run this script. Would appreciate any help! Am not a VB
programmer.
Was given this script to use.

'//Declare API Function Declarations from Kernel32 DLL
Declare Function GetEnvironmentVariableA Lib "kernel32" ( _
   ByVal lpName As String, _
   ByVal lpBuffer As String, _
   ByVal nsize As Long) As Long

'Returns Client Computer Name by retrieving 32bit environment variable.
Private Function GetClientComputerName() As String
   
   Dim lStringLength As Long     'Len of String
   Dim sEnv As String          ''' buffer To hold environment string

   'Allocate space for Dos Environment String.
   sEnv = Space(4096)
   
   'Get data for given environment variable.
   lStringLength = GetEnvironmentVariableA("CLIENTNAME", sEnv, 4096)
   
   'Pull value based on lpszenv length.
   GetClientComputerName = Left(sEnv, lStringLength)
   
   
End Function
Dirk Goldgar - 31 Aug 2005 16:38 GMT
> I keep getting error message "Only comments can appear after End Sub
> etc..." when I try to run this script. Would appreciate any help! Am
[quoted text clipped - 23 lines]
>
> End Function

There's nothing wrong with the code you posted.  Switch the module to
full-module view and look for extraneous statements that don't belong --
for example, executable statements that aren't inside a procedure.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.