I wrote a Sub Procedure and tried to use it in the RunCode macro, but the description of the RunCode states you have plae the Sub in a Function. I tried that and it did not work. Does anyone know about this?
I wrote a Sub Procedure and tried to use it in the RunCode macro, but the description of the RunCode states you have plae the Sub in a Function. I tried that and it did not work. Does anyone know about this?
Don't place the sub within a function change the sub to a function. Give the Function a type of Boolean
Change
Public Sub Yoursub()
to
Public function YourSub() As Boolean
use this at the end
Yoursub = True
End Function
When I enter OutStandingMember() in the RunCode area I get the following error:
"The expression you entered has a function name that MS Office Access can't find."
Below is the top portion of the code from the Module object OutStandingMember I'm using:
Option Compare Database
Public Function OutStandingMember() As Boolean
On Error GoTo OutstandingMember_Error
Dim ws As Workspace
Dim db As Database
Dim rsMemberStatus As Recordset
Dim rsTemp2 As Recordset
Dim g As String
Dim j As Integer
Dim s As Integer
Set ws = DBEngine.Workspaces(0)
Set db = CurrentDb
Under the Option Compare put in Option Explicit. This requires you to define all of your variables makes it easier to debug.
If you do a compile to you get an error message?
Also I use ADO so I'm not sure about this but I believe that it should be Set db = ws.currentdb
I just converted all of the macros to vb code. It's working now.
You need to put parenthesis/brackets after the function name in the macro.
eg MyFunc()