精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • VB里的問題

    VB里的問題
    我這段查詢是在一個(gè)文本框里顯示的.我想改成表格形式的.
    Private Sub Command2_Click()
    '查詢
    If Combo1.Text = "" Then
    MsgBox "你沒有選擇查詢方式,請選擇!",16,"錯(cuò)誤提示!"
    Exit Sub
    End If
    If Combo1 "全部記錄" And Text4.Text = "" Then
    MsgBox "你沒有填寫查詢的關(guān)鍵字,請?zhí)顚?",16,"錯(cuò)誤提示!"
    Exit Sub
    End If
    Dim XX As Integer,SS As Integer
    XX = 0:SS = 0:Text5.Text = "日 期" & Space(20) & "購買單位" & Space(16) & "用戶單位" & Space(10) & "聯(lián)系人" & Space(10) & "聯(lián)系電話" & Space(10) & vbCrLf
    Call SJK(db)
    RS.Open "Select * From 表1",db,3,3
    SS = RS.RecordCount
    RS.Close
    Set RS = Nothing
    If Combo1.Text = "全部記錄" Then
    txtSQL = "Select * From 表1"
    ElseIf Combo1.Text = "以姓名查詢" Then
    txtSQL = "Select * From 表1 Where T2 Like '%" & Text4.Text & "%'"
    ElseIf Combo1.Text = "以內(nèi)容查詢" Then
    txtSQL = "Select * From 表1 Where T3 Like '%" & Text4.Text & "%'"
    End If
    RS.Open txtSQL,db,2,2
    Do While Not RS.EOF
    XX = XX + 5
    Text5.Text = Text5.Text & RS!T1 & 16 & RS!T2 & vbCrLf
    RS.MoveNext
    Loop
    RS.Close
    Set RS = Nothing
    db.Close
    Set db = Nothing
    If SS > 0 Then
    If XX = 0 Then
    MsgBox "對不起!你選擇方式中的關(guān)鍵字可能有誤,沒有你查詢的記錄!請重新查詢!",48,"無記錄!"
    End If
    Else
    MsgBox "對不起!你的數(shù)據(jù)庫中沒有記錄,請首先錄入記錄!",48,"數(shù)據(jù)庫是空的!"
    End If
    End Sub
    Public Sub SJK(db)
    db.ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);dbQ=" & App.Path & "\ABCD.mdb"
    db.Open
    End Sub
    Private Sub Command3_Click()
    Unload Me
    其他查詢.Show
    End Sub
    Private Sub Command4_Click()
    End
    End Sub
    Private Sub Form_Load()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    End Sub
    Private Sub MSFlexGrid1_Click()
    End Sub
    其他人氣:410 ℃時(shí)間:2020-09-26 17:48:44
    優(yōu)質(zhì)解答
    '添加一個(gè)MSFlexGrid1把
    'Do While Not RS.EOF
    'XX = XX + 5
    'Text5.Text = Text5.Text & RS!T1 & 16 & RS!T2 & vbCrLf
    'RS.MoveNext
    'Loop
    'RS.Close
    '這段改為:
    With MSFlexGrid1
    .FixedCols = 0
    .FixedRows = 1
    .Cols = 5
    .FormatString = "日 期|購買單位|用戶單位|聯(lián)系人|聯(lián)系電話"
    .ColWidth(0) = 2000 '列寬(數(shù)值自己修改)
    .ColWidth(1) = 2000
    .ColWidth(2) = 2000
    .ColWidth(3) = 2000
    .ColWidth(4) = 2000
    Dim i As Integer
    Do While Not RS.EOF
    XX = XX + 5
    i = i + 1
    If i >= .Rows Then .Rows = i + 1
    .TextMatrix(i, 1) = RS!T1 '不知道你的T1 T2是第幾列的值自己修改吧
    .TextMatrix(i, 2) = RS!T2
    RS.MoveNext
    Loop
    RS.Close
    End With
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版