Compile Error Only Comments May Appear After End Sub
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 06 Oct 2016 00:12:03 GMT by s_hv999 (squid/3.5.20)
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_other/compile-error-only-comments/0c46b226-29ed-415e-aef5-6bb0662f1426 a minute: Sign up “Compile Error: Only Comments may appear after End Sub, End Function..” Access 2010 VBA up vote 0 down vote favorite I am creating a form and I have created my first function in the VBA window. The function creates Buttons. After I type anything after the 'End function' I get an error- "Only comments appear after .." What's http://stackoverflow.com/questions/12327805/compile-error-only-comments-may-appear-after-end-sub-end-function-access-2 wrong? Am I putting the function in the wrong area? Here is my code: Option Compare Database Option Explicit Function MainMenuOptions() Dim frm As String frm = "Main" Dim SCFormB As Control Dim SCSearchB As Control Dim SCReportB As Control Set SCFormB = CreateControl(frm, acOptionButton, , , , 0.5, 0.6, 1.5, 0.55) Set SCSearchB = CreateControl(frm, acOptionButton, , , , 0.5, 1.5, 1.5, 0.55) Set SCReportB = CreateControl(frm, acOptionButton, , , , 0.5, 2.4, 1.5, 0.55) End Function vb6 ms-access-2010 share|improve this question edited Jul 15 at 0:19 Serenity 4,78761342 asked Sep 8 '12 at 3:37 Victor Marcano 882715 Why would you need to type anything after End Function ? –McGarnagle Sep 8 '12 at 3:46 Unless this is to save you time in development, it is not a good idea. You should not need to create buttons in a finalized project. –Fionnuala Sep 8 '12 at 8:11 I am trying to make a dynamic form. On the main form window i inserted the function. I have done some reseaching and found that i am su
may appear after End Sub?) If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before http://www.vbforums.com/showthread.php?656271-RESOLVED-Help-(Only-Comments-may-appear-after-End-Sub-) you can post: click the register link above to proceed. To start http://www.dbforums.com/showthread.php?1622127-Compile-error-only-comments-may-appear-after-End-Sub-End-Function-or-End-Property viewing messages, select the forum that you want to visit from the selection below. Results 1 to 7 of 7 Thread: [RESOLVED] Help...(Only Comments may appear after End Sub?) Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jul compile error 28th, 2011,12:41 AM #1 anjanakshay View Profile View Forum Posts Thread Starter Junior Member Join Date Jul 2011 Posts 22 [RESOLVED] Help...(Only Comments may appear after End Sub?) Hi... This is a program to accept 2 given strings from the user and count the number of times the second string appears in the first string. The program needs to design and display a splash compile error only screen also as the program loads. While running the above program , an error is displayed as Error : Only Comments may appear after End Sub,End Function or End Property ====================================== The code for Splash Screen is : Private Sub Form_Load() lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." App.Revision lblProductName.Caption = App.Title End Sub ====================================== The code for String Occurrence is : Private Sub Command1_Click() Dim pos, p_pos, cnt As Integer p_pos = 1 pos = 1 cnt = 1 Do pos = InStr(p_pos, Text1, Text2, vbTextCompare) p_pos = p_pos + pos If pos <> 0 Then cnt = cnt + 1 Loop While pos <> 0 Text3.Text = cnt End Sub --------------------------------------- Public fMainForm As frmMain Sub Main() frmSplash.Show frmSplash.Refresh Set fMainForm = New frmMain Load fMainForm Unload frmSplash fMainForm.Show End Sub ====================================== I put the first code of string occurrence first..Then another error as user-defined type not defined. May be these are all silly doubts....But it seems HUGE for a newcomer.. Sorry for asking... Expecting your valuable reply... Reply With Quote Jul 28th, 2011,03:11 AM #2 seenu_1st View Profile View Forum
Sub, End Function, or End Property If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: Compile error: only comments may appear after End Sub, End Function, or End Property Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 09-05-07,12:57 #1 Miguel View Profile View Forum Posts Registered User Join Date Apr 2002 Location Portugal Posts 146 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! Reply With Quote 09-05-07,13:50 #2 Teddy View Profile View Forum Posts Purveyor of Discontent 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? *** Reply With Quote 09-07-07,07:49 #3 Miguel View Profile View Forum Posts Registered User Join Date Apr 2002 Location Portugal Posts 146 Thanks for your reply. I've