Here's [in my opinion] the pertinent code:
1. Clicked event that Calls the Function which is in a bas module.
Private Sub cmdDefaulters_Click()
Dim strSQLText, strMsgText, strFolio, StrCode As String
Dim curAmount, curAmountOwed As Currency
strCnn = ConnectString 'ConnectString is a function in a Bas Module that returns the connection string.
'rstFolio & rstCode are Declared in Bas Module As Recordset.
Set rstFolio = New ADODB.Recordset
Set rstCode = New ADODB.Recordset
strSQLText = "Select [Folio] from [StudentDataTest]"
Set rstFolio.DataSource = ExecuteSQL(strSQLText, strMsgText)
StrFolio = RstFolio!Folio
End Sub
'2. This is the Function Declaration: in a Bas Module.
Public Function ExecuteSQL(ByVal SQL _
As String, MsgString As String) _
As ADODB.Recordset
*******
When I try & run with a full compile I get:
"ByRef argument Type Mismatch"
& it highlights "strMsgText"
in "ExecuteSQL(strSQLText, strMsgText)"
It appears to be running fine but it wont compile. . .
Any ideas?
Robeen
1. Clicked event that Calls the Function which is in a bas module.
Private Sub cmdDefaulters_Click()
Dim strSQLText, strMsgText, strFolio, StrCode As String
Dim curAmount, curAmountOwed As Currency
strCnn = ConnectString 'ConnectString is a function in a Bas Module that returns the connection string.
'rstFolio & rstCode are Declared in Bas Module As Recordset.
Set rstFolio = New ADODB.Recordset
Set rstCode = New ADODB.Recordset
strSQLText = "Select [Folio] from [StudentDataTest]"
Set rstFolio.DataSource = ExecuteSQL(strSQLText, strMsgText)
StrFolio = RstFolio!Folio
End Sub
'2. This is the Function Declaration: in a Bas Module.
Public Function ExecuteSQL(ByVal SQL _
As String, MsgString As String) _
As ADODB.Recordset
*******
When I try & run with a full compile I get:
"ByRef argument Type Mismatch"
& it highlights "strMsgText"
in "ExecuteSQL(strSQLText, strMsgText)"
It appears to be running fine but it wont compile. . .
Any ideas?
Robeen