Basic Information
Software: Microsoft Access 2000
OS: Microsoft Windows XP Professional SP3
I've been trying to make some of the behind-the-scenes coding for one of my forms available in a module such as creating a query from certain inputs:
Where strDelim is AND or OR. The problem is that it currently outputs to a string strSQLContent that is not declared in the module I have this library of functions defined in. It is, however, defined in the individual form. Is there some way for this function to just return the variable strSQLContent from the library as a string. Example:
So far I've gotten that I should append the function declaration with As String but is that really all it takes? I have no way to test the code since I'm working on only one part of it at the moment. Of the few results I've found, I came across THIS which only served to confuse me.
How would I change the code I have? I'm already familiar with Java and how to do it like that, but I'm just beginning with VBA. In Java you simply put Return variable, in this case strSQLContent.
Software: Microsoft Access 2000
OS: Microsoft Windows XP Professional SP3
I've been trying to make some of the behind-the-scenes coding for one of my forms available in a module such as creating a query from certain inputs:
Code:
Function EqualsAttachAnd(sField As String, sValue As String, strDelim As String)
If sValue = "''" Or sValue = "" Then Exit Function
Else
sValue = Trim(sValue)
strSQLContent = strSQLContent & strDelim & sField & "= '" & sValue & "'"
End If
End Function
Code:
Call lib.EqualsAttachAnd("Customer",Me.txtCustomer," AND ")
'returns this string:
" AND [Customer] = 'Microsoft'"
So far I've gotten that I should append the function declaration with As String but is that really all it takes? I have no way to test the code since I'm working on only one part of it at the moment. Of the few results I've found, I came across THIS which only served to confuse me.
How would I change the code I have? I'm already familiar with Java and how to do it like that, but I'm just beginning with VBA. In Java you simply put Return variable, in this case strSQLContent.
Comment