R
Robert Brown
I have this routine which changes the source for my crosstab query
Sub ChangeXTab()
Dim strSql As String
Dim strCategory As String, strLocation As String
strCategory = "LEGIONELLA MONITORING"
strLocation = "Gents1 Lhs Shower (Carriage)"
strSql = "TRANSFORM Sum(tblTestResults.TestResultsResults) AS
SumOfTestResultsResults " & _
"SELECT tblTestResults.TestResultsDateSampled " & _
"FROM (tblTestDetails INNER JOIN tblTest ON (tblTestDetails.TestName =
tblTest.TestName) AND (tblTestDetails.TestCategory = tblTest.TestCategory))
INNER JOIN tblTestResults ON tblTestDetails.TestDetailsIdentifier =
tblTestResults.TestDetailsIdentifier " & _
"WHERE (((tblTestResults.TestResultsDateSampled) In (select top 4
tbltestresults.testresultsdatesampled from tbltestresults)) AND
((tblTestDetails.CategoryName)='" & strCategory & "') AND
((tblTestDetails.LocationName)='" & strLocation & "')) " & _
"GROUP BY tblTestResults.TestResultsDateSampled " & _
"ORDER BY tblTestResults.TestResultsDateSampled DESC , tblTest.TestName " &
_
"PIVOT tblTest.TestName;"
CurrentDb.QueryDefs("qryXTabLast4ResultsByDate").SQL = strSql
DoCmd.OpenReport "rptXTabLast4ResultsByDate", acViewPreview
End Sub
This open routine changes the source for the 4 fields on the report
Private Sub Report_Open(Cancel As Integer)
Me.Controls("txtBox1").ControlSource = "BOD (mg/l)"
Me.Controls("txtBox2").ControlSource = "pH"
Me.Controls("txtBox3").ControlSource = "Suspended solids (mg/l)"
Me.Controls("txtBox4").ControlSource = "Total oil (mg/l"
End Sub
But I am now getting the error 3270 - property not found.
Any suggestions ?
Rob
Sub ChangeXTab()
Dim strSql As String
Dim strCategory As String, strLocation As String
strCategory = "LEGIONELLA MONITORING"
strLocation = "Gents1 Lhs Shower (Carriage)"
strSql = "TRANSFORM Sum(tblTestResults.TestResultsResults) AS
SumOfTestResultsResults " & _
"SELECT tblTestResults.TestResultsDateSampled " & _
"FROM (tblTestDetails INNER JOIN tblTest ON (tblTestDetails.TestName =
tblTest.TestName) AND (tblTestDetails.TestCategory = tblTest.TestCategory))
INNER JOIN tblTestResults ON tblTestDetails.TestDetailsIdentifier =
tblTestResults.TestDetailsIdentifier " & _
"WHERE (((tblTestResults.TestResultsDateSampled) In (select top 4
tbltestresults.testresultsdatesampled from tbltestresults)) AND
((tblTestDetails.CategoryName)='" & strCategory & "') AND
((tblTestDetails.LocationName)='" & strLocation & "')) " & _
"GROUP BY tblTestResults.TestResultsDateSampled " & _
"ORDER BY tblTestResults.TestResultsDateSampled DESC , tblTest.TestName " &
_
"PIVOT tblTest.TestName;"
CurrentDb.QueryDefs("qryXTabLast4ResultsByDate").SQL = strSql
DoCmd.OpenReport "rptXTabLast4ResultsByDate", acViewPreview
End Sub
This open routine changes the source for the 4 fields on the report
Private Sub Report_Open(Cancel As Integer)
Me.Controls("txtBox1").ControlSource = "BOD (mg/l)"
Me.Controls("txtBox2").ControlSource = "pH"
Me.Controls("txtBox3").ControlSource = "Suspended solids (mg/l)"
Me.Controls("txtBox4").ControlSource = "Total oil (mg/l"
End Sub
But I am now getting the error 3270 - property not found.
Any suggestions ?
Rob