KevinBaker
New member
- Local time
- Today, 16:16
- Joined
- Aug 23, 2020
- Messages
- 25
In a module I have:
On a FormA if I have a Public Sub called cmHelloWorld like this:
Using a button on the form I run this code:
When I press the button frmTest2 opens correctly, however when I click the Continue button on frmTest2, which calls modContinue, trying to run cmHelloWorld fails with "Expected procedure, not variable
Code:
Public FormArray(9) As String
Public Sub modContinue()
If FormArray(0) <> "" Then
Select Case left$(FormArray(0), 2)
Case "fr": DoCmd.OpenForm FormArray(0)
Case "cm": Call FormArray (0)
End Select
'Shift the remaining elements up one
For i = 1 To UBound(FormArray)
FormArray(i - 1) = FormArray(i)
Next
Else
If Not IsNull(TempVars!frmReport) Then
Forms(TempVars!frmReport).Visible = True
End If
'Open the report
On Error Resume Next
DoCmd.OpenReport TempVars!txtRptName, View:=acViewPreview
If Err = 2501 Then
Err.Clear
Exit Sub
End If
DoCmd.Maximize
End If
End Sub
On a FormA if I have a Public Sub called cmHelloWorld like this:
Code:
Public Sub cmHelloWorld()
MsgBox "Hello World"
End Sub
Using a button on the form I run this code:
Code:
FormArray(0) = "frmTest2"
FormArray(1) = "cmHelloWorld"
Call modContinue
When I press the button frmTest2 opens correctly, however when I click the Continue button on frmTest2, which calls modContinue, trying to run cmHelloWorld fails with "Expected procedure, not variable