可是不能实现循环提醒的功能
我很是郁闷
有谁能帮我做个简单的备忘录,只要能实现周期提醒就可以了
我想参考参考
小弟感恩不禁
我先谢谢大家了
Dim myado As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub add_Click()
add.Enabled = False
Text1.Text = ""
Text2.Text = Now
Text3.Text = ""
Text1.SetFocus
save.Enabled = True
del.Enabled = False
End Sub
Private Sub del_Click()
If Val(List2.List(List1.ListIndex)) <> 18 Then
rs.Find "ID=" & Val(List2.List(List1.ListIndex))
rs.Delete
rs.Update
rs.MoveFirst
list2init
save.Enabled = False
del.Enabled = False
End If
End Sub
Private Sub Form_Load()
myado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "/adu.mdb;Persist Security Info=False"
myado.Open
rs.Open "select * from beizhu order by 备忘时间", myado, 1, 3
list2init
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
xunhuaninit
End Sub
Private Sub List1_Click()
rs.MoveFirst
rs.Find "ID=" & Val(List2.List(List1.ListIndex))
A = "ID=" & Val(List2.List(List1.ListIndex))
Text1.Text = rs.Fields("备忘时间")
If rs.Fields("备忘时间") < Now Then
Text1.ForeColor = &HFFFF&
Else
Text1.ForeColor = &HFF00FF
End If
Text2.Text = rs.Fields("操作时间")
Text3.Text = rs.Fields("备忘内容")
xunhuan = rs.Fields("周期")
If xunhuan = "0" Then
Option1.Value = True
End If
If xunhuan = "1" Then
Option2.Value = True
End If
If xunhuan = "2" Then
Option3.Value = True
End If
List1.ToolTipText = List1.Text
save.Enabled = True
del.Enabled = True
add.Enabled = True
End Sub
Private Sub save_Click()
If Text1.Text = "" Then
MsgBox "备忘时间不能为空!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "操作时间不能为空!"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "备忘内容不能为空!"
Text3.SetFocus
Exit Sub
End If
If Option1.Value = True Then
xunhuan = "0"
End If
If Option2.Value = True Then
xunhuan = "1"
End If
If Option3.Value = True Then
xunhuan = "2"
End If
On Error GoTo A
If add.Enabled = False Then
rs.AddNew
rs.Fields("备忘时间") = Text1.Text
rs.Fields("操作时间") = Text2.Text
rs.Fields("备忘内容") = Text3.Text
rs.Fields("周期") = xunhuan
rs.Update
list2init
Else
rs.Find "ID=" & Val(List2.List(List1.ListIndex))
rs.Fields("备忘时间") = Text1.Text
rs.Fields("操作时间") = Text2.Text
rs.Fields("备忘内容") = Text3.Text
rs.Fields("周期") = xunhuan
rs.Update
list2init
End If
save.Enabled = False
del.Enabled = False
Exit Sub
A:
MsgBox "时间填写有误!"
End Sub
Public Sub list2init()
List1.Clear
List2.Clear
List3.Clear
rs.MoveFirst
Do While Not rs.EOF
List1.AddItem rs.Fields("备忘内容")
List2.AddItem rs.Fields("ID")
List3.AddItem rs.Fields("备忘时间")
rs.MoveNext
Loop
End Sub
Private Sub Timer1_Timer()
For i = 0 To List3.ListCount - 1
If List3.List(i) = Now Then
Me.SetFocus
Me.Caption = "你有备忘录了!请查看."
MsgBox "你好! 请看下面的备忘记录: " & Now & vbCrLf & List1.List(i)
xunhuaninit
list2init
Me.Caption = "备忘录"
End If
Next
label5 = Now
End Sub
Public Sub xunhuaninit()
rs.MoveFirst
Do While Not rs.EOF
If rs.Fields("周期") = "1" And rs.Fields("备忘时间") < Now Then
rs.Fields("备忘时间") = rs.Fields("备忘时间") + 1
End If
If rs.Fields("周期") = "2" And rs.Fields("备忘时间") < Now Then
rs.Fields("备忘时间") = rs.Fields("备忘时间") + 30
End If
rs.MoveNext
Loop
End Sub