7,765
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command4_Click()
Dim i As Integer
Dim strCustID As String
Dim blnHave As Boolean
strCustID = InputBox("please input want query")
If strCustID <> "" Then
With Adodc1
.Recordset.MoveFirst
For i = 1 To .Recordset.RecordCount
If .Recordset.Fields("供应商号") & "" = strCustID Then
Exit For
blnHave = True
End If
.Recordset.MoveNext
Next i
If blnHave Then
MsgBox "有相关记录"
Else
MsgBox "没有相关记录"
End If
End With
Else
MsgBox "没有输入任何信息"
End If
End Sub
Private Sub Command1_Click()
Me.Hide
Form3.Show
Form3.Text1.Text = Form2.Text1.Text
Form3.Text2.Text = Form2.Text2.Text
Form3.Text3.Text = Form2.Text3.Text
Form3.Text4.Text = Form2.Text4.Text
Form3.Text5.Text = Form2.Text5.Text
Form3.Command3.Visible = False
End Sub
Private Sub Command2_Click()
Unload Me
Form3.Show
Form3.Command1.Visible = False
End Sub
Private Sub Command3_Click()
If MsgBox("确定要删除本信息吗", vbQuestion + vbYesNo, "敬告") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub Command4_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSql As String
Dim strName As String
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\商品管理.mdb;Persist Security Info=False"
strName = InputBox("please input want query")
If strName <> "" Then
rs.Open "select * from 供应商信息 where 供应商号=" & strName & " ", cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
Text1.Text = rs.Fields("供应商号") & ""
Text2.Text = rs.Fields("供应商名") & ""
Text3.Text = rs.Fields("地址") & ""
Text4.Text = rs.Fields("联系电话") & ""
Text5.Text = rs.Fields("银行账户") & ""
Else
MsgBox "没有相关记录"
End If
rs.Close
Set rs = Nothing
Else
MsgBox "没有输入任何信息"
End If
cn.Close
Set cn = Nothing
End Sub
Private Sub Command5_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveFirst
Command6.Enabled = False
End If
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
Command7.Enabled = False
End If
End Sub
Private Sub Command8_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub Command9_Click()
Unload Me
Form4.Show
End Sub
Private Sub Text1_Change()
If Command6.Enabled = False Or Command7.Enabled = False Then
Command6.Enabled = True
Command7.Enabled = True
End If
End Sub
Private Sub Command1_Click()
With CreateObject("ADODB.Connection")
.Open Yourcnstring'Write you connection string here.
Text1.Text = .Execute("select field1 from table").getstring()'Get all field1 from table
.Close
End With
End Sub
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSql As String
Dim strName As String
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mydb.mdb;Persist Security Info=False"
strName = InputBox("please input want query")
If strName <> "" Then
rs.Open "select * from mytable where id='" & strName & "' ", cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
Text1.Text = rs.Fields("id") & ""
MsgBox "have"
Else
MsgBox "not have"
End If
rs.Close
Set rs = Nothing
Else
MsgBox "no input"
End If
cn.Close
Set cn = Nothing
End Sub