engeltje237
01-09-2005, 03:44 AM
hey,
I've got an error in the following code.
Private Sub lstBVVO_Click()
BVVO = lstBVVO.Text
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=KBC.mdb;Persist Security Info=False"
Set con = New adoDB.Connection
con.Open (connectionstring)
sql = "SELECT distinct agentnrintern FROM (Agent INNER JOIN Agentennummer ON Agent.agentnrextern = Agentennummer.agentnrextern)" _
& "INNER JOIN Claim_definitief ON Agentennummer.agentnrextern =" _
& "Claim_definitief.agentnrextern where Claim_definitief.BVVO= '" & BVVO & "'"
Set rec = New adoDB.Recordset
rec.Open sql, con, adOpenKeyset, adLockOptimistic, adCmdText
If Not rec.EOF Then
rec.MoveFirst
While Not rec.EOF
lstagent.AddItem rec.Fields.Item(0).Value
rec.MoveNext
Wend
End If
End Sub
But when don't use the where-clause in the query everything works perfect? What is the problem?
BVVO is a variable declared on top as dim BVVO as string
I've got an error in the following code.
Private Sub lstBVVO_Click()
BVVO = lstBVVO.Text
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=KBC.mdb;Persist Security Info=False"
Set con = New adoDB.Connection
con.Open (connectionstring)
sql = "SELECT distinct agentnrintern FROM (Agent INNER JOIN Agentennummer ON Agent.agentnrextern = Agentennummer.agentnrextern)" _
& "INNER JOIN Claim_definitief ON Agentennummer.agentnrextern =" _
& "Claim_definitief.agentnrextern where Claim_definitief.BVVO= '" & BVVO & "'"
Set rec = New adoDB.Recordset
rec.Open sql, con, adOpenKeyset, adLockOptimistic, adCmdText
If Not rec.EOF Then
rec.MoveFirst
While Not rec.EOF
lstagent.AddItem rec.Fields.Item(0).Value
rec.MoveNext
Wend
End If
End Sub
But when don't use the where-clause in the query everything works perfect? What is the problem?
BVVO is a variable declared on top as dim BVVO as string