请看看下面的代码要怎么修改?
有一个组合框,combo1供用户选择电器的分类。当用户选择了一个以后,从一个名字为“品牌”的数据库中查找相应的与分类对应的品牌名字。再把它们添加到combo2中。小弟的代码是这样写的:
Public wsp As DAO.Workspace
Public db As DAO.Database
Public rst As DAO.Recordset
Private Sub GetPingPai()
Dim aa As Integer, bb As String
aa = Combo1.text
bb = aa & "品牌"
Set wsp = DBEngine.CreateWorkspace("wsp", "admin", "")
Set db = wsp.OpenDatabase(App.Path & "\data\dbPingPai.mdb")
Set rst = db.OpenRecordset("SELECT * FROM bb")
With rst
Do Until .EOF
Me.Combo2.AddItem rst!品牌
.MoveNext
Loop
End With
End Sub
Private Sub Combo1_Click()
GetPingPai
End Sub
运行这后vb报错说在指定的数据库中找不到名称为"bb的表,bb是我在程序中定义的变量,在sql语句中不能引用已定义的变量吗?