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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Compile Error - Only comments may appear after end sub,...
Hello,
I am a novice VBA user and keep getting a compile error in my program. Here is some of my code. The compile error I get says "Only comments may appear after End Sub, End Function or End Property". The Me in the line Me!ClassDate.SetFocus is highlighted in blue with a yellow arrow pointing to the line Private Sub Command27_Click(). Can someone help? Thanks, ---------------------------------------------------------------------------------------- Private Sub Command27_Click() On Error GoTo Err_Command27_Click DoCmd.Close Exit_Command27_Click: Exit Sub Err_Command27_Click: MsgBox Err.Description Resume Exit_Command27_Click End Sub Me!ClassDate.SetFocus DoCmd.FindRecord Date Me!ClassDate.SetFocus End Sub -- Chuck W |
#2
|
|||
|
|||
Compile Error - Only comments may appear after end sub,...
On Tue, 19 Dec 2006 08:21:01 -0800, ChuckW wrote:
Hello, I am a novice VBA user and keep getting a compile error in my program. Here is some of my code. The compile error I get says "Only comments may appear after End Sub, End Function or End Property". The Me in the line Me!ClassDate.SetFocus is highlighted in blue with a yellow arrow pointing to the line Private Sub Command27_Click(). Can someone help? Thanks, ---------------------------------------------------------------------------------------- Private Sub Command27_Click() On Error GoTo Err_Command27_Click DoCmd.Close Exit_Command27_Click: Exit Sub Err_Command27_Click: MsgBox Err.Description Resume Exit_Command27_Click End Sub **** Me!ClassDate.SetFocus DoCmd.FindRecord Date Me!ClassDate.SetFocus End Sub **** You have 2 End Subs in one sub procedure. I've marked them with asterisks. Everything after the first end sub is misplaced. I have no idea what you want to do with those extra lines, as it appears you are closing the form. You can't set focus to a control on the form when it is closed. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|