jmentor
08-27-2005, 11:59 AM
I have a calling form with the following code
Dim strTbl As String
Dim strTitle As String
Dim strSQL As String
strTbl = Me.cboRep.Column(0)
strTitle = Me.cboRep.Column(1)
strSQL = "SELECT tblSupp.SuppName, tblCurr.CurrName, * " _
& "FROM tblCurr INNER JOIN (" & strTbl & " INNER JOIN tblSupp " _
& "ON " & strTbl & ".SuppID = tblSupp.SuppID) " _
& "ON tblCurr.CurrID = " & strTbl & ".CurrID;"
DoCmd.OpenReport "rptList", acViewPreview, , , , strSQL & "," & strTitle
On the Report's OnOpen Event I have
Dim strStr1 As String
strStr1 = Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1)
Me.RecordSource = strStr1
And on the Report's On Activate Event I have
Dim strStr2 As String
strStr2 = Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
Me.txtTitle = strStr2
This should work but it doesn't. The error states that the SQL statement
was not found. Of course, without the second concatenated argument
and Me.RecordSouce = Me.openArgs everything works fine.
Can anybody see where I have gone wrong
Thanks
Dim strTbl As String
Dim strTitle As String
Dim strSQL As String
strTbl = Me.cboRep.Column(0)
strTitle = Me.cboRep.Column(1)
strSQL = "SELECT tblSupp.SuppName, tblCurr.CurrName, * " _
& "FROM tblCurr INNER JOIN (" & strTbl & " INNER JOIN tblSupp " _
& "ON " & strTbl & ".SuppID = tblSupp.SuppID) " _
& "ON tblCurr.CurrID = " & strTbl & ".CurrID;"
DoCmd.OpenReport "rptList", acViewPreview, , , , strSQL & "," & strTitle
On the Report's OnOpen Event I have
Dim strStr1 As String
strStr1 = Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1)
Me.RecordSource = strStr1
And on the Report's On Activate Event I have
Dim strStr2 As String
strStr2 = Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
Me.txtTitle = strStr2
This should work but it doesn't. The error states that the SQL statement
was not found. Of course, without the second concatenated argument
and Me.RecordSouce = Me.openArgs everything works fine.
Can anybody see where I have gone wrong
Thanks