A family of Microsoft relational database management systems designed for ease of use.
To elaborate on theDBguy:
strFormPrefix is indeed a Variant, as you dimmed it.
Debug.Print VarType(strFormPrefix)
0 '0=vbEmpty
Passing such undefined variable to GetFormNameFromPrefix causes the error: VBA does not know what the data type will be at runtime, so it fails at compile time.
The fix is:
Dim strFormPrefix As String
Beyond that, you seem to be somewhat random about the use of ByRef/ByVal.
Here are some guidelines:
- If you don't specify ByRef/ByVal, then it is ByRef by default.
- If the procedure does not modify the argument, or modifies it but doesn't mean for the calling proc to know that value, declare as ByVal.
- Only declare as ByRef if you mean the calling procedure to know the new value you're changing in the called proc.
- Objects (e.g. recordsets, controls, forms) should be declared ByRef, showing your understanding that objects are always passed as pointers, not as their (potentially very large) actual object bytes.