I am creating these in a module, but they don't retain their value out side of it. Here's my code.
Code:
Public Function Assign_Globals()
On Error GoTo Err_Handler
Dim gstrVendor_Name As String
Dim gstrPath As String
Dim gintAccounting_Period As Integer
Dim gintFiscal_Year As Integer
Dim gstrImport_File As String
Dim gstrMacro_File As String
Dim gstrStatement_Type As String
Dim strCriteria As String
strCriteria = "[Vendor_ID] = '" & Forms!frmUpdateCMX!cboVendor & "'"
gstrVendor_Name = DLookup("[Vendor_Name]", "tblVendor", strCriteria)
gstrPath = DLookup("[Path]", "tblVendor", strCriteria)
gintAccounting_Period = Forms!frmUpdateCMX!cboAccountingPeriod
gintFiscal_Year = Forms!frmUpdateCMX!txtFiscalYear
gstrImport_File = DLookup("[Import_File]", "tblVendor", strCriteria)
gstrMacro_File = DLookup("[Macro_File]", "tblVendor", strCriteria)
gstrStatement_Type = DLookup("[Statement_Type]", "tblVendor", strCriteria)
Exit_Function:
Exit Function
Err_Handler:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Function
Resume Next
End Function
When I try to use Global or Public instead of Dim I get "Invalid attribute in Sub or Function."