Hi, im working through a guide on using sql and parameters in VB6, im using the BIBLIO.MDB that come with vb6. Ive been orking through the code in the manual but when i enter the follwing bit it comes up with error "complile error expected end of statement", ive gone through everything and it all looks exctly as it should according to the instructions. Id be reallky gratefull if anyone coulf have a quick look and point out any mistakes.
Code:
Sub runQuery()
Dim dbf As Database, rectemp As Recordset
Dim qdftemp As QueryDef
Dim strSQL As String
Dim blnfoundquery As Boolean
On Error GoTo queryerror
Set dbftemp = Workspaces(0).OpenDatabase(bibio_path & _
"\biblio.mdb")
For Each qdftemp In dbftemp.QueryDefs
If qdftemp.Name = "publishers titles by author" Then
blnfoundquery = True
Exit For
End If
Next

If blnfoundquery = False Then
strSQL = "PARAMETERS pintPubID Long; " & _
"SELECT Authors.Author, Titles.Title, " & _
"titles.ISBN, " & _
"Titles.[year published], Publishers.name " & _
"From (publishers inner join titles on "
strSQL = strSQL & "publishers.PubID = " _
"Titles.PubID) " & _
"INNER JOIN " & _
"(Authors INNER JOIN [Title Author] ON " & _
"Authors.au_ID = [Title Author].Au.ID) on " & _
"Titles.ISBN = [Title Author].ISBN WHERE " & _
"publishers.pubID " & _
"= pintPubID ORDER by Authors.Author;"
Set qdbftemp = dbftemp.CreateQueryDef( _
"publisher's titles by " & _
"author", strSQL)
Else
Set qdftemp = dbftemp.QueryDefs( _
"publisher's titles by author")
End If
qdftemp.Parameters![pintpubid] = selectedpubid
Set dtadata.Recordset = gdftemp.OpenRecordset()
If dtadata.Recordset.RecordCount > 0 Then
frmmain.Caption = "chapter 5.7 example - " & _
Str$(dtadata.Recordset.RecordCount) & _
IIf(dtadata.Recordset.RecordCount = 1, _
" Title", " Titles")
Else
    frmmain.Caption = frmmain.Caption = "chapter 5.7 _ example - no titles"
End If
On Error GoTo 0
Exit Sub
queryerror:
MsgBox Err.Description, vbExclamation
Exit Sub
End Sub
The erro comes up at lines
Code:
strSQL = strSQL & "publishers.PubID = " _
"Titles.PubID) " & _
"INNER JOIN " & _
"(Authors INNER JOIN [Title Author] ON " & _
"Authors.au_ID = [Title Author].Au.ID) on " & _
"Titles.ISBN = [Title Author].ISBN WHERE " & _
"publishers.pubID " & _
"= pintPubID ORDER by Authors.Author;"
Thanks for your time