我是TyBCA学生我正在创建一个窗口应用程序,使用VB作为前端,MS Access作为后端。当我在其中创建健身房管理系统软件时,我无法弄清楚我的搜索代码中的问题是什么。
根据它应该是当我点击搜索Btn时,应该出现一个消息框/对话框询问"输入要搜索的名称"结果应显示在名为" MS1"的数据网格上。和" MS"。
MS1.Visible = False
MS.Visible = True
Command4.Visible = False
Command6.Visible = True
id = InputBox("enter the id")
rr.Open "select * from tblMembers where Member_id=" & id, cn, adOpenDynamic, adLockOptimistic
If Not (rr.EOF) Then
MS.Cols = 20
MS1.TextMatrix(0, 0) = "Member_id"
MS1.TextMatrix(0, 1) = "First_Name"
MS1.TextMatrix(0, 2) = "Last_Name"
MS1.TextMatrix(0, 3) = "Gender"
MS1.TextMatrix(0, 4) = "Membership"
MS1.TextMatrix(0, 5) = "Address"
MS1.TextMatrix(0, 6) = "Zip_Code"
MS1.TextMatrix(0, 7) = "Date_Of_Birth"
MS1.TextMatrix(0, 8) = "Mobile_No"
MS1.TextMatrix(0, 9) = "Medical_History"
MS1.TextMatrix(0, 10) = "Pay_Due_Date"
MS1.TextMatrix(0, 11) = "Amount"
MS1.TextMatrix(0, 12) = "Installed_amt"
MS1.TextMatrix(0, 13) = "Balance"
MS1.TextMatrix(0, 14) = "Profile"
rr.MoveFirst
r = 1
Do While Not rr.EOF
MS1.Rows = MS1.Rows + 1
MS1.TextMatrix(r, 0) = rr.Fields(0)
MS1.TextMatrix(r, 1) = rr.Fields(1)
MS1.TextMatrix(r, 2) = rr.Fields(2)
MS1.TextMatrix(r, 3) = rr.Fields(3)
MS1.TextMatrix(r, 4) = rr.Fields(4)
MS1.TextMatrix(r, 5) = rr.Fields(5)
MS1.TextMatrix(r, 6) = rr.Fields(6)
MS1.TextMatrix(r, 7) = rr.Fields(7)
MS1.TextMatrix(r, 8) = rr.Fields(8)
MS1.TextMatrix(r, 9) = rr.Fields(9)
MS1.TextMatrix(r, 10) = rr.Fields(10)
MS1.TextMatrix(r, 11) = rr.Fields(11)
MS1.TextMatrix(r, 12) = rr.Fields(12)
MS1.TextMatrix(r, 13) = rr.Fields(13)
rr.MoveNext
r = r + 1
Loop
rr.Close
答案 0 :(得分:0)
它没什么价值,但在你的代码中你只显示MS(前两行),然后只填写MS1。