So, I did some searching and couldn't find anything specific to what I'm trying to do so I figured I'd just ask.
I'm using the Office 365 version of Access. Trying to create a database to track my call statistics (current and historical). I've got the form laid out, and the code working in VBA to pull the stats based on overall or a specific client (selected by a drop down). However, I'd really like to streamline the code on the main form using modules, but I can't seem to get that working.
Right now, all the code (see snippet example below) is stored in the main form in an extremely long Select Case statement. It makes scrolling through to tweak something arduous. So, I created a module called BellevueStats and moved the code snipped below into the module. Then in the Case statement, I simply called the BellevueStats module. That resuled in a compile error: invalid outside procedure. For the life of me, I cannot figure out how to fix it. The code works fine when it's all in the VBA of the main form, but the moment I move a client out to a module, I get the invalid outside procedure error.
Code:
'Sets the variables and their definitions
currtotalcalls = DCount("EntryType", "StoredData", "Date BETWEEN #" & Me.tb_startdate & "# AND #" & Me.tb_enddate & "# AND SchoolCode='Bel' AND EntryType='Call'")
prevtotalcalls = DCount("EntryType", "StoredData", "Date BETWEEN #" & Me.tb_prevstartdate & "# AND #" & Me.tb_prevenddate & "# AND SchoolCode='Bel' AND EntryType='Call'")
diffcalls = currtotalcalls - prevtotalcalls
mtdtotalcalls = DCount("EntryType", "StoredData", "Date BETWEEN #" & Me.tb_mtdstart & "# AND #" & Me.tb_mtdend & "# AND SchoolCode='Bel' AND EntryType='Call'")
'Sets the value of the text boxes to the result of the associated variables
Me.tb_totalcalls.Value = currtotalcalls
Me.tb_prevtotalcalls.Value = prevtotalcalls
Me.tb_difftotalcalls.Value = diffcalls
Me.tb_mtdtotalcalls.Value = mtdtotalcalls
I'd really love to be able to put the individual schools/clients code into their own modules if that is possible. Thanks in advance for any advice!