I can pass a parameter from the button click which opens a report which has this function referenced in a text box.
Function MHList(rept As String)
Dim oRS As Recordset
Dim sDistinctSQL As String
Dim sGeneralSQL As String
Dim sRecord
Dim sWONum() As String
Dim i As Integer
Dim strCSVals As String
Dim rptWO As String
MsgBox rept 'This works fine
rptWO = [Reports]![& rept &]![txtWorkOrderNo] 'This fails
The rept value though in the last line keeps failing with a 2451 The report name '& rept &' you entered is misspelled or refers to a report that isn't open or doesn't exist. If mouse over the rept in debug mode it show "thereport" so it is recognizing the name correctly, but the formating or something is off.
Thanks in advance!!