Reputation: 615
Been away form coding and don't have my reference docs. Have this bit of code.
Private Sub RunPivotButton_Click()
Dim TblLenSQL As String
TblLenSQL = "SELECT Count(dbo_Transaction_Table.Sequence_Number) AS
CountOfSequence_Number," _
TblLenSQL = TblLenSQL & " From dbo_Transaction_Table"
Dim CRDcon As ADODB.Connection
Set TranCnt = CurrentProject.Connection
Dim CountRS As New ADODB.Recordset
crdRs.ActiveConnection = TranCnt
crdRs.CursorType = adOpenStatic
crdRs.Open TblLenSQL
End Sub
When I add the second line of code for building the query I get
"Expected Ed of statement TblLenSQL = TblLenSQL & " From dbo_Transaction_Table"
Something basic and trivial but I can't see it.
Thanks jpl458
Upvotes: 0
Views: 59
Reputation: 27644
Either concatenate in a single statement - using the line-continuation character _
...
TblLenSQL = "SELECT Count(dbo_Transaction_Table.Sequence_Number) AS CountOfSequence_Number," & _
" From dbo_Transaction_Table"
... or don't - using multiple statements ...
TblLenSQL = "SELECT Count(dbo_Transaction_Table.Sequence_Number) AS CountOfSequence_Number,"
TblLenSQL = TblLenSQL & " From dbo_Transaction_Table"
... there is no both.
Your SQL statement is incomplete (SELECT x, FROM y
) but you are probably aware of that.
Upvotes: 1