VB缺少:结束语句

来源:百度知道 编辑:UC知道 时间:2024/06/21 05:18:02
我是菜鸟,大家帮我看一下,下面哪地方出错了,谢谢!!
Private Sub Form_Click()
Dim s As String
Dim Conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\xuexi\vb6.0\bf\data.mdb" '打开数据库
'关闭数据库
Conn.Close
Set Conn = Nothing
'读取数据
Dim rs As New ADODB.Recordset
Dim spl1 As String
Dim plan As String
Dim sex As String
Dim bx_years As String
Dim tb_years As String
plan = InputBox("请选择计划")
sex = InputBox("请选择性别")
bx_years = InputBox("请选择保险期间")
tb_years = InputBox("请输入投保年龄")
sql1= "select id form jb where plan='"&plan&"' and sex='"&sex&"' and bx_years='"&bx_years&"' and tb_years='"&tb_years&"'"

你在最后写上end sub就OK
Private Sub Form_Click()
Dim s As String
Dim Conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\xuexi\vb6.0\bf\data.mdb" '打开数据库
'关闭数据库
Conn.Close
Set Conn = Nothing
'读取数据
Dim rs As New ADODB.Recordset
Dim spl1 As String
Dim plan As String
Dim sex As String
Dim bx_years As String
Dim tb_years As String
plan = InputBox("请选择计划")
sex = InputBox("请选择性别")
bx_years = InputBox("请选择保险期间")
tb_years = InputBox("请输入投保年龄")
sql1= "select id form jb where plan='"&plan&"' and sex='"&sex&"' and bx_years='"&bx_years&"' and tb_years='"&tb_years&"'"
end sub

.....
sql1= "select id from jb where plan='"&plan&"'