Private Sub Check1_Click()
If Check1.Value = 1 Then
DTP1.Enabled = True
Else
DTP1.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
DTP2.Enabled = True
Else
DTP2.Enabled = False
End If
End Sub
Private Sub cmd_Click()
Set cn = New ADODB.Connection
Set res = New ADODB.Recordset
cn.Open "provider=SQLOLEDB;server=it;database=khgl1;uid=sa;pwd=123456"
res.CursorLocation = adUseClient
res.Open "select * from khgl", cn, adOpenStatic, adLockOptimistic
Set frm_xxxg.MSHFlexGrid1.DataSource = res
On Error Resume Next
If Check1.Value = 1 Then
res!来电时间 = DTP1.Value
res!去电时间 = DTP2.Value
-----
res.Update
res.Close
MsgBox ("修改成功")
这是我的修改代码,修改日期,当存入日期之后,无法清空了,主要采用 check控件控制dtpicker,希望在dtpicker就成灰色,修改保存的时候不存入日期!
If Check1.Value = 1 Then
DTP1.Enabled = True
Else
DTP1.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
DTP2.Enabled = True
Else
DTP2.Enabled = False
End If
End Sub
Private Sub cmd_Click()
Set cn = New ADODB.Connection
Set res = New ADODB.Recordset
cn.Open "provider=SQLOLEDB;server=it;database=khgl1;uid=sa;pwd=123456"
res.CursorLocation = adUseClient
res.Open "select * from khgl", cn, adOpenStatic, adLockOptimistic
Set frm_xxxg.MSHFlexGrid1.DataSource = res
On Error Resume Next
If Check1.Value = 1 Then
res!来电时间 = DTP1.Value
res!去电时间 = DTP2.Value
-----
res.Update
res.Close
MsgBox ("修改成功")
这是我的修改代码,修改日期,当存入日期之后,无法清空了,主要采用 check控件控制dtpicker,希望在dtpicker就成灰色,修改保存的时候不存入日期!
If Check1.Value = 1 Then
res!来电时间 = DTP1.Value
res!去电时间 = DTP2.Value
-----
res.Update
else
res!来电时间 = ""
res!去电时间 = ""
-----
res.Update
end if
看看有没有 trigger
update set = null
else
update set = dtp1.value
end if
我经常用和好用
set 来电时间='"&dtp1.value &"'
就ok了