Foxtable(狐表)用户栏目专家坐堂 → [求助]重复删除代码


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

主题:[求助]重复删除代码

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


加好友 发短信
等级:童狐 帖子:238 积分:1838 威望:0 精华:0 注册:2014/7/1 8:56:00
[求助]重复删除代码  发帖心情 Post By:2014/7/23 8:39:00 [只看该作者]

我要在下面的代码中再加上一个对另外一个表进行重复删除的代码,请指教该如何写,写在哪里?

 

谢谢!

 

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("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.Save()
Tables("车辆违章表").Current.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
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
Tables("车辆表").Current.Save()
Tables("车辆表").Current.Locked = True
Tables("单位表").Current.Save()
Tables("单位表").Current.Locked = True


 回到顶部