private Command1_Click()
Dim a as string
a = text1.text
OpenQuery "SELECT * FROM a WHERE Chair;"
txtChair.Text = myRs.Fields(0).Value
myRs.MoveNext
loop
end sub
答案 0 :(得分:0)
您的代码示例缺少一个开始Do
语句,可能是一个过度站点。另外,@ nabuchodonossor是正确的,因为在最后一个循环结束时,最后一条记录的字段(0)的值将在txtChair.Text中。但是你要求帮助的是建立一个单独的字符串查询,你可以用变量值代替字符串的一部分。
Private Command1_Click()
Dim a as string
a = text1.text
'this query isn't right, but not sure what to do with it
'this is something like normally "WHERE Field = 'Chair'"
OpenQuery "SELECT * FROM " & a & " WHERE Chair;" 'The & concatenates the separate strings
Do While rs.EOF = False
txtChair.Text = myRs.Fields(0).Value
myRs.MoveNext
Loop
End Sub