View Full Version : Compile Error - Comments appear after end sub?


james_IT
12-11-2006, 12:42 PM
hi,

could someone check out the attached image and tell me where im going wrong?

when i try to open the form in form mode this error comes up?

i dont understand, its been working fine until now...

thanks

jeremypaule
12-11-2006, 12:57 PM
what does the form timer code and the code below it look like?

boblarson
12-11-2006, 12:59 PM
So, you've included the entire module code in here? I don't see why it would do it from the screen shot.

pdx_man
12-11-2006, 02:13 PM
May need to do Ye Olde /Decompile. Search ...

james_IT
12-11-2006, 03:06 PM
this is the form codes:


Option Compare Database

Private Sub Form_Close()
DoCmd.Hourglass False
DoCmd.OpenForm "frmMainMenu"
End Sub
Private Sub Form_Load()
DoCmd.Maximize
Dim varTime As Variant, strLegend As String
varTime = Time()

If varTime > "00:00:01" And varTime < "12:00" Then strLegend = "Welcome! Good Morning..."
If varTime >= "12:00" And varTime < "18:00" Then strLegend = "Welcome! Good Afternoon..."
If varTime >= "18:00" And varTime < "23:59" Then strLegend = "Welcome! Good Evening..."

Me.lblGreeting.Caption = strLegend
End Sub

Private Sub Form_Timer()
On Error Resume Next

DoCmd.Hourglass True
Me.TimerInterval = 0

Me.Repaint
DoEvents

ProcessTables

DoCmd.Hourglass False
DoCmd.Close acForm, "frmIntro", acSaveNo
End Sub






and this is the module linked to the form:

Option Compare Database
Option Explicit

Public fCancel As Boolean

Sub ProcessTables()
On Error GoTo Err_Handler

Dim lngCurrentPosition As Long
Dim intTable As Integer
Dim strMsg As String

DoCmd.Hourglass True
lngCurrentPosition = 0

For lngCurrentPosition = 0 To 10000
intTable = lngCurrentPosition \ 100
strMsg = "Processing table #" & intTable

UpdateProgressMeter strMsg, lngCurrentPosition

DoEvents
lngCurrentPosition = lngCurrentPosition + 1
If fCancel Then Exit For
Next

Exit_Here:
DoCmd.Hourglass False
Exit Sub

Err_Handler:
MsgBox Err.Description
fCancel = False
Resume Exit_Here

End Sub

Private Sub UpdateProgressMeter(ByVal strMsg As String, ByVal lngPosition As Long)
On Error Resume Next

Dim intPercent As Integer
Const conTotal As Integer = 10000

intPercent = (lngPosition / conTotal) * 100

With Forms!frmIntro
!lblBlue.Width = intPercent / 100 * !lblTransparent.Width
!lblMessage.Caption = "" & intPercent & "%"
.Repaint
End With

DoEvents

End Sub