Private Sub Form_Load()
Dim db As Database
Dim rec As Recordset
Set db = OpenDatabase("D:\Documents and Settings\Administrator\My Documents\城市的评价要素+权数(德尔非法).mdb")
Set rec = db.OpenRecordset("城市的评价要素", dbOpenTable)
rec.Index = "表的索引"
rec.Seek "=", Form1.Combo2.Text
If rec.NoMatch Then
Exit Sub
End If
MSFlexGrid1.Rows = 2
MSFlexGrid1.FontSize = 12
MSFlexGrid1.Cols = rec.Fields.Count
For i = 0 To rec.Fields.Count - 1
MSFlexGrid1.ColWidth(i) = MSFlexGrid1.Width / rec.Fields.Count
Next i
MSFlexGrid1.Row = 0
For i = 0 To rec.Fields.Count - 1
MSFlexGrid1.Col = i
MSFlexGrid1.Text = rec.Fields(i).Name
Next i
MSFlexGrid1.Row = 1
For j = 0 To rec.Fields.Count - 1
MSFlexGrid1.Col = j
MSFlexGrid1.Text = rec(j)
Next j
End Sub
怎么程序运行后,出现的结果不是我查询的东西!而是全部显示了!!
我晕了!