01.
Public
cn
As
ADODB.Connection
02.
Public
RS
As
ADODB.Recordset
03.
Sub
fillcombo()
04.
Set
RS =
New
ADODB.Recordset
05.
06.
Set
cn =
New
ADODB.Connection
07.
08.
cn.ConnectionString =
"Provider = Microsoft.Jet.OLEDB.4.0;Data Source= "
& (App.Path &
"\time3.mdb"
) &
"; persist security info = false"
09.
cn.Open
10.
11.
RS.Open
"select * from Table1 "
, cn, adOpenStatic, adLockPessimistic
12.
13.
14.
While
RS.EOF =
False
15.
Combo1.AddItem RS!DateNow
16.
RS.MoveNext
17.
Wend
18.
RS.Close
19.
Set
RS =
Nothing
20.
End
Sub
21.
22.
23.
24.
Private
Sub
Combo1_Click()
25.
Set
cn =
New
ADODB.Connection
26.
Set
RS =
New
ADODB.Recordset
27.
cn.ConnectionString =
"Provider = Microsoft.Jet.OLEDB.4.0;Data Source= "
& (App.Path &
"\time3.mdb"
) &
"; persist security info = false"
28.
cn.Open
29.
RS.Open
"select * from Table1 where DateNow = '"
& Combo1.Text &
"'"
, cn, 3, 3
30.
If
Not
RS.EOF
Then
31.
Me
.Combo1.Text = RS!DateNow
32.
33.
34.
End
If
35.
Set
RS =
Nothing
36.
37.
38.
39.
End
Sub
40.
41.
Private
Sub
Command3_Click()
42.
Dim
find
As
String
43.
find = Combo1.Text
44.
Adodc1.Recordset.find
"DateNow ="
& find
45.
46.
End
Sub
47.
48.
Private
Sub
DataGrid1_Click()
49.
Set
cn =
New
ADODB.Connection
50.
Set
RS =
New
ADODB.Recordset
51.
cn.ConnectionString =
"Provider = Microsoft.Jet.OLEDB.4.0;Data Source= "
& (App.Path &
"\time3.mdb"
) &
"; persist security info = false"
52.
cn.Open
53.
RS.Open
"select * from Table1 where DateNow = '"
& Combo1.Text &
"'"
, cn, 3, 3
54.
55.
End
Sub
56.
57.
Private
Sub
Form_Load()
58.
Me
.fillcombo
59.
End
Sub