Foxtable(狐表)用户栏目专家坐堂 → [求助]如果有空白字段就不保存,返回重填


  共有3831人关注过本帖平板打印复制链接

主题:[求助]如果有空白字段就不保存,返回重填

帅哥哟,离线,有人找我吗?
荟美绘姿
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:238 积分:1838 威望:0 精华:0 注册:2014/7/1 8:56:00
[求助]如果有空白字段就不保存,返回重填  发帖心情 Post By:2014/8/21 21:51:00 [只看该作者]

Tables("车辆违章表").AddNew()
If e.Form.Controls("TextBox10").Text = "" Then
    MessageBox.Show("编号中的年份不能为空")
    Return
End If

If e.Form.Controls("TextBox1").Text = "" Then
    MessageBox.Show("编号中的序号不能为空")
    Return
End If

If e.Form.Controls("TextBox2").Text = "" Then
    MessageBox.Show("当事人名称不能为空")
    Return
End If

If e.Form.Controls("TextBox4").Text = "" Then
    MessageBox.Show("地址不能为空")
    Return
End If

If e.Form.Controls("TextBox5").Text = "" Then
    MessageBox.Show("联系电话不能为空")
    Return
End If

If e.Form.Controls("TextBox6").Text = "" Then
    MessageBox.Show("邮政编码不能为空")
    Return
End If

If e.Form.Controls("TextBox3").Text = "" Then
    MessageBox.Show("车牌号码不能为空")
    Return
End If

If e.Form.Controls("ComboBox1").Text = "" Then
    MessageBox.Show("车牌颜色不能为空")
    Return
End If

If e.Form.Controls("ComboBox2").Text = "" Then
    MessageBox.Show("案发地点不能为空")
    Return
End If

If e.Form.Controls("DateTimePicker1").Text = "" Then
    MessageBox.Show("案发时间不能为空")
    Return
End If

If e.Form.Controls("ComboBox3").Text = "" Then
    MessageBox.Show("违法行为不能为空")
    Return
End If

If e.Form.Controls("ComboBox4").Text = "" Then
    MessageBox.Show("处理环节不能为空")
    Return
End If

Tables("车辆违章表").current("编号_年份")=e.Form.Controls("TextBox10").text
Tables("车辆违章表").current("编号_序列号")=e.Form.Controls("TextBox1").text
Tables("车辆违章表").current("单位基本情况_单位名称")=e.Form.Controls("TextBox2").text
Tables("车辆违章表").current("单位基本情况_地址")=e.Form.Controls("TextBox4").text
Tables("车辆违章表").current("单位基本情况_联系电话")=e.Form.Controls("TextBox5").text
Tables("车辆违章表").current("单位基本情况_邮政编码")=e.Form.Controls("TextBox6").text
Tables("车辆违章表").current("车辆基本情况_车牌号码")=e.Form.Controls("TextBox3").text
Tables("车辆违章表").current("车辆基本情况_车牌颜色")=e.Form.Controls("ComboBox1").text
Tables("车辆违章表").current("违章基本情况_违章地点")=e.Form.Controls("ComboBox2").text
Tables("车辆违章表").current("违章基本情况_违章时间")=e.Form.Controls("DateTimePicker1").text
Tables("车辆违章表").current("违章基本情况_违章行为")=e.Form.Controls("ComboBox3").text
Tables("车辆违章表").current("处理环节")=e.Form.Controls("ComboBox4").text
Tables("车辆违章表").current("处罚情况_案件状态")="未处理"
DataTables("车辆违章表").Save()
DataTables("车辆违章表").ReplaceFor("_Locked",True,"")

Tables("单位表").AddNew()
Tables("车辆表").AddNew()
Tables("单位表").current("单位名称")=e.Form.Controls("TextBox2").text
Tables("车辆表").current("单位名称")=e.Form.Controls("TextBox2").text
Tables("单位表").current("地址")=e.Form.Controls("TextBox4").text
Tables("单位表").current("联系电话")=e.Form.Controls("TextBox5").text
Tables("单位表").current("邮政编码")=e.Form.Controls("TextBox6").text
Tables("车辆表").current("车牌号码")=e.Form.Controls("TextBox3").text
Tables("车辆表").current("车牌颜色")=e.Form.Controls("ComboBox1").text
Tables("车辆表").current("起点")=e.Form.Controls("TextBox7").text
Tables("车辆表").current("目的地")=e.Form.Controls("TextBox8").text
Tables("车辆表").current("途径地")=e.Form.Controls("TextBox9").text
Dim i As Integer
For i  = DataTables("车辆表").DataRows.Count-1 To 0 Step -1
    Dim dr As DataRow = DataTables("车辆表").DataRows(i)
    Dim dr2 As DataRow = DataTables("车辆表").Find("车牌号码='" & dr("车牌号码") & "' and 车牌颜色='" & dr("车牌颜色")& "' and _Identify <> " & dr("_Identify"))
    If dr2 IsNot Nothing Then
        dr2.Delete
    End If
Next
For i  = DataTables("单位表").DataRows.Count-1 To 0 Step -1
    Dim dr As DataRow = DataTables("单位表").DataRows(i)
    Dim dr2 As DataRow = DataTables("单位表").Find("单位名称='" & dr("单位名称") & "' and 地址='" & dr("地址") & "' and _Identify <> " & dr("_Identify"))
    If dr2 IsNot Nothing Then
        dr2.Delete
    End If
Next
Tables("车辆表").Current.Save()
Tables("车辆表").Current.Locked = True
Tables("单位表").Current.Save()
Tables("单位表").Current.Locked = True



请大侠帮我看一下下,在这个代码的基础上加上,当有字段有空白时则不保存,并返回到重新填写

 回到顶部