|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 it113are 于 2012-3-25 19:43 编辑
日期输入可以但是输入空白日期就会出错
怎么办呢?
可以请那位大侠帮我解决一下这个问题???
有试著加一个判断
if Me.TextBox14.Text <> "" then
错误讯息是消失了!
但是数据一样无法输入到access数据库
怎么办
Dim RS5 As Recordset
Dim DB5 As Database
Set DB5 = OpenDatabase(ThisWorkbook.Path & "\" & "Amanufactory1.mdb")
Set RS5 = DB5.OpenRecordset(Name:="ahrlist1", Type:=dbOpenDynaset)
RS5.FindFirst "ahr_id=" & TextBox19
With RS5
If RS5.NoMatch = True Then
MsgBox "杅擂祥湔婓,彆剒猁崝樓杅擂萸僻怀", 1 + 64, "炵苀枑尨"
Else
.Edit
.Fields("unit_name").Value = ComboBox3
.Fields("class_name").Value = TextBox2
.Fields("state_name").Value = ComboBox2
.Fields("card_num").Value = TextBox3
.Fields("list_name").Value = TextBox4
.Fields("level").Value = TextBox5
.Fields("job").Value = TextBox6
.Fields("m_name").Value = TextBox7
.Fields("pm_num1").Value = TextBox8
.Fields("pm_num2").Value = TextBox9
.Fields("pm_num3").Value = TextBox10
.Fields("um_num1").Value = TextBox11
.Fields("um_num2").Value = TextBox12
.Fields("um_num3").Value = TextBox13
.Fields("into_fist_date") = CDate(Me.TextBox14.Text) 不能输入空白日期怎么办?
.Fields("va_date").Value = CDate(TextBox18.Text)
.Fields("b_date").Value = TextBox15.Value
.Fields("leave_date").Value = TextBox16.Value
.Fields("note").Value = TextBox17
.Update
MsgBox "党蜊傖髡!", 1 + 64, "炵苀枑尨"
ListView1.SelectedItem.SubItems(20) = TextBox17
ListView1.SelectedItem.SubItems(19) = TextBox16
ListView1.SelectedItem.SubItems(18) = TextBox15
ListView1.SelectedItem.SubItems(17) = TextBox18
ListView1.SelectedItem.SubItems(16) = TextBox14
ListView1.SelectedItem.SubItems(15) = TextBox13
ListView1.SelectedItem.SubItems(14) = TextBox12
ListView1.SelectedItem.SubItems(13) = TextBox11
ListView1.SelectedItem.SubItems(12) = TextBox10
ListView1.SelectedItem.SubItems(11) = TextBox9
ListView1.SelectedItem.SubItems(10) = TextBox8
ListView1.SelectedItem.SubItems(9) = TextBox7
ListView1.SelectedItem.SubItems(8) = TextBox6
ListView1.SelectedItem.SubItems(7) = TextBox5
ListView1.SelectedItem.SubItems(6) = TextBox4
ListView1.SelectedItem.SubItems(5) = TextBox3
ListView1.SelectedItem.SubItems(4) = ComboBox2
ListView1.SelectedItem.SubItems(3) = TextBox2
ListView1.SelectedItem.SubItems(2) = ComboBox3
ListView1.SelectedItem.SubItems(1) = TextBox19
End If
End With
RS5.Close
DB5.Close
End If
|
|