duanecwilson
Programmer
I have an object variable I was setting all over the place in different subs, etc of a form module. I decided to try to do it on a module wide basis, much like regular variables, but I got an error something like "Not valid outside of procedure" and the Set word was highlighted at compile time. Please let me know how I can do this, as it seems quite redundant and error prone to set it all over the place. Below is the code at the top of my Form nodule:
Option Compare Database
Option Explicit
'This is the column number from the combobox in Wave1Select that contains SRC_CUST_ID
Public intSrcCustIDidx As Integer
Dim frm As Form
Set frm = Forms!frmWave1Select
Dim cboSelection As Control
Set cboSelection = frm!cboWave1Select
Dim modcancel As Boolean
Dim strSRC_CUST_ID As String
-------------------------
Private Sub .... etc.
...
...
End Sub
-------------------------
Duane Wilson
Option Compare Database
Option Explicit
'This is the column number from the combobox in Wave1Select that contains SRC_CUST_ID
Public intSrcCustIDidx As Integer
Dim frm As Form
Set frm = Forms!frmWave1Select
Dim cboSelection As Control
Set cboSelection = frm!cboWave1Select
Dim modcancel As Boolean
Dim strSRC_CUST_ID As String
-------------------------
Private Sub .... etc.
...
...
End Sub
-------------------------
Duane Wilson