我想問的是~~我要收尋資料庫已建好的資料~~想把找到的資料顯示在form2第2個視窗上不知要加入哪些指令下面是我寫的程式:
(1) form1:
Private Sub Command1_Click()
Dim num As String
num = Trim(InputBox$(\"請輸入學號\", \"學號收尋\", \"\"))
num = \"學號 =\'\" & num & \"\'\"
Data1.Recordset.FindFirst num
Form2.Show
Form1.Hide
If Data1.Recordset.NoMatch Then
Form2.Hide
return_value = MsgBox(\"資料庫裡找不到資料\", \"0\", \"訊息\")
Form1.Show
End If
End Sub
2006-07-22 12:49:32 · 1 個解答 · 發問者 阿瑞 1 in 電腦與網際網路 ➔ 程式設計
那假如我要把資料顯示在我 form2裡的 text上要改裡
麻煩一下謝謝
2006-07-22 13:51:44 · update #1
'以下在Form1Private Sub Command1_Click() Dim num As String, I As Integer num = Trim(InputBox$("請輸入學號", "學號收尋", "")) num = "學號 ='" & num & "'" Data1.Recordset.FindFirst num If Data1.Recordset.NoMatch Then return_value = MsgBox("資料庫裡找不到資料", "0", "訊息") Else Form1.Hide Form2.Show With Data1.Recordset For I = 0 To .Fields.Count - 1 Form2.Print .Fields(I).Name; "→"; .Fields(I) Next End With End IfEnd Sub'以下在Form2Private Sub Form_Unload(Cancel As Integer) Cls Form1.ShowEnd Sub
2006-07-23 00:46:11 補充:
Form2.Print .Fields(I).Name; "→"; .Fields(I)改成Form2.Text1=Form2.Text1 & .Fields(I).Name & "→" & .Fields (I) & " "
2006-07-22 13:36:12 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋