J
jschping
Hi,
OK. This makes NO sense. I have 3 modules. One is the regular Concatenate by
Duane Hookum that works in tons of my applications. (I just modified it to
put in a carriage return, but that works fine in other applications.) That
code is at:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=16
The second is a module to ascertain the width of a text box by Stephen
Lebans. Also, it works just fine in other applications. This can be found at:
http://www.lebans.com/textwidth-height.htm
I have a new application, and BOTH the above modules worked just fine and
did their jobs perfectly. Then I added the following new module and all heck
broke lose. Now as soon as I open the application I get an immediate error
message on the following line of code from Hookum's module:
If Len(strConcat) > 0 Then
strConcat = Left(strConcat, _
Len(strConcat) - Len(pstrDelim))
End If
The error says: "Compile Error. Array expected." But the vaiable strConcat
is declared as a string!! And it usually works fine!!!!
Here is the new module that causes (somehow) the trouble. I know that it's
the culprit since if I delete this module, the error goes away. It's to
modify a pop-up form to show a progress bar while the other code executes.
(Even weirder the code in the module ALSO worked! It was only after using it
a few times that the trouble started, without any changes (that I know of) to
the code. It's SO WEIRD. )
Please help!!!
Thanks,
John Schping
Option Compare Database
Option Explicit
Global The_Current_Percent As Integer
'Set a variable for the current percent
Global Original_Percent As Integer
'Set a variable for the percent that is being set by the code
Global Top, Left As Integer
'Set global size variables
Const Full_Width = 2.5 * 1440
'Set the full possible width of the status bar
Const WaitMessageHeight = 1.25 * 1440
Const WaitMessageWidth = 3.075 * 1440
Public Sub OpenWaitMessage()
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
Original_Percent = 0
The_Current_Percent = 0
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
Top = 3.25 * 1440
Left = (([Forms]![Main_Student_Info_Form].WindowWidth - (3 * 1440)) / 2) + _
[Forms]![Main_Student_Info_Form].WindowLeft
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
DoEvents
End Sub
Public Sub Increment_Wait_Percentage()
'Increment the percentage if it's not 10 more than the last code-set
percentage
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
If The_Current_Percent < (Original_Percent + 10) Then
The_Current_Percent = The_Current_Percent + 1
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
End If
End Sub
Public Sub Update_Wait_Percentage(New_Percent As Integer)
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
Original_Percent = New_Percent
The_Current_Percent = Original_Percent
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
End Sub
Public Sub Close_Wait_Message()
DoCmd.Close acForm, "Wait_Message_Form"
End Sub
OK. This makes NO sense. I have 3 modules. One is the regular Concatenate by
Duane Hookum that works in tons of my applications. (I just modified it to
put in a carriage return, but that works fine in other applications.) That
code is at:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=16
The second is a module to ascertain the width of a text box by Stephen
Lebans. Also, it works just fine in other applications. This can be found at:
http://www.lebans.com/textwidth-height.htm
I have a new application, and BOTH the above modules worked just fine and
did their jobs perfectly. Then I added the following new module and all heck
broke lose. Now as soon as I open the application I get an immediate error
message on the following line of code from Hookum's module:
If Len(strConcat) > 0 Then
strConcat = Left(strConcat, _
Len(strConcat) - Len(pstrDelim))
End If
The error says: "Compile Error. Array expected." But the vaiable strConcat
is declared as a string!! And it usually works fine!!!!
Here is the new module that causes (somehow) the trouble. I know that it's
the culprit since if I delete this module, the error goes away. It's to
modify a pop-up form to show a progress bar while the other code executes.
(Even weirder the code in the module ALSO worked! It was only after using it
a few times that the trouble started, without any changes (that I know of) to
the code. It's SO WEIRD. )
Please help!!!
Thanks,
John Schping
Option Compare Database
Option Explicit
Global The_Current_Percent As Integer
'Set a variable for the current percent
Global Original_Percent As Integer
'Set a variable for the percent that is being set by the code
Global Top, Left As Integer
'Set global size variables
Const Full_Width = 2.5 * 1440
'Set the full possible width of the status bar
Const WaitMessageHeight = 1.25 * 1440
Const WaitMessageWidth = 3.075 * 1440
Public Sub OpenWaitMessage()
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
Original_Percent = 0
The_Current_Percent = 0
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
Top = 3.25 * 1440
Left = (([Forms]![Main_Student_Info_Form].WindowWidth - (3 * 1440)) / 2) + _
[Forms]![Main_Student_Info_Form].WindowLeft
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
DoEvents
End Sub
Public Sub Increment_Wait_Percentage()
'Increment the percentage if it's not 10 more than the last code-set
percentage
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
If The_Current_Percent < (Original_Percent + 10) Then
The_Current_Percent = The_Current_Percent + 1
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
End If
End Sub
Public Sub Update_Wait_Percentage(New_Percent As Integer)
Dim frm As Form
DoCmd.OpenForm "Wait_Message_Form"
Set frm = Forms("Wait_Message_Form")
Original_Percent = New_Percent
The_Current_Percent = Original_Percent
frm.Box_Status.Width = (The_Current_Percent / 100) * Full_Width
'Reset the staus box to be the width of the percentage
frm.Percentage.Caption = The_Current_Percent & " %"
'Set the percentage label
DoCmd.MoveSize Left, Top
frm.InsideHeight = WaitMessageHeight
frm.InsideWidth = WaitMessageWidth
frm.Repaint
End Sub
Public Sub Close_Wait_Message()
DoCmd.Close acForm, "Wait_Message_Form"
End Sub