K
Kurt Heisler
I have two large SQL statements that I need to use across several
forms, reports, etc.
Rather than repeat them in each form, I'm trying to store and
reference them globally.
For example, I'd like to store strSQL1 and strSQL2 in a global module,
so I can use either like this in a form:
Random form:
Me!lstResults.RowSource = strSQL1
Random report:
Me.Report.RecordSource = strSQL2
Would I just store the SQL statements in a global module like:
Public Function SQLSource() As String
Dim strSQL1 As String
Dim strSQL2 As String
strSQL1 = "SELECT blah blah"
strSQL2 = "SELECT blah blah"
End Function
If so, how would I refer to it elsewhere. Like:
Me.Report.RecordSource = strSQL2 'need to call the function first
(SQLSource), and then pick the correct SQL
Thanks.
forms, reports, etc.
Rather than repeat them in each form, I'm trying to store and
reference them globally.
For example, I'd like to store strSQL1 and strSQL2 in a global module,
so I can use either like this in a form:
Random form:
Me!lstResults.RowSource = strSQL1
Random report:
Me.Report.RecordSource = strSQL2
Would I just store the SQL statements in a global module like:
Public Function SQLSource() As String
Dim strSQL1 As String
Dim strSQL2 As String
strSQL1 = "SELECT blah blah"
strSQL2 = "SELECT blah blah"
End Function
If so, how would I refer to it elsewhere. Like:
Me.Report.RecordSource = strSQL2 'need to call the function first
(SQLSource), and then pick the correct SQL
Thanks.