以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  看看代码哪里有不对  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=26727)

--  作者:kmzb56
--  发布时间:2012/12/12 17:36:00
--  看看代码哪里有不对
  我在窗口的保存按钮里设置了这些代码:想达到如果有些控件没有值时返回窗口输入,并不保存后面的值,直到输入有值时保存才能通过,:但我发现,如果没有值时提示了,但去不返回输入,也顺序通过代码,也保存了后面的值,没达到想要的目的。请问应该在哪里加点代码?If e.form.controls("DateTimePicker1").value=Nothing Then 
    MessageBox.show("请输入日期!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox6").value=Nothing Then 
    MessageBox.show("请输入货量描述!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox8").value=Nothing Then 
    MessageBox.show("请输入订金方式!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox10").value=Nothing Then 
    MessageBox.show("请输入经手办公室!")
    e.cancel=True
\'ElseIf  e.form.controls("NumericComboBox8").value=Nothing Then 
\'    MessageBox.show("请输入运价!")
\'    e.cancel=True
ElseIf  e.form.controls("NumericComboBox6").value=Nothing Then 
    MessageBox.show("请输实收现金!")
    e.cancel=True
ElseIf  e.form.controls("TextBox5").value=Nothing Then 
    MessageBox.show("请输入手机号!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox4").value=Nothing Then 
    MessageBox.show("请输入装货地址!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox5").value=Nothing Then 
    MessageBox.show("请输入下货地址!")
    e.cancel=True
ElseIf  e.form.controls("NumericComboBox4").value=Nothing Then 
    MessageBox.show("请输入报给承运方费用!")
    e.cancel=True
ElseIf  e.form.controls("NumericComboBox11").value=Nothing Then 
    MessageBox.show("请输入报给客户费用!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox7").value=Nothing Then 
    MessageBox.show("请输入议价方式!")
    e.cancel=True
ElseIf  e.form.controls("ComboBox9").value=Nothing Then 
    MessageBox.show("请输发票方式!")
    e.cancel=True
End If
Tables("派车记录表").Current("客户名称") = e.form.Controls("TextBox8").Value
Tables("派车记录表").Current("货物名称") = e.form.Controls("ComboBox2").Value
Tables("派车记录表").Current("重量") = e.form.Controls("NumericComboBox1").Value
Tables("派车记录表").Current("付款方式") = e.form.Controls("ComboBox3").Value
Tables("派车记录表").Current("装货地") = e.form.Controls("ComboBox4").Value
Tables("派车记录表").Current("目的地") = e.form.Controls("ComboBox5").Value
Tables("派车记录表").Current("备注") = e.form.Controls("TextBox11").Value
Tables("派车记录表").Current("车型") = e.form.Controls("ComboBox1").Value
Tables("派车记录表").Current("重量描述")=e.form.Controls("ComboBox6").Value 
Tables("派车记录表").Current("装货电话")=e.form.Controls("TextBox6").Value
Tables("派车记录表").Current("到手价单车吨价")=e.form.Controls("NumericComboBox4").Value
\'Tables("派车记录表").Current("应收合计")=e.form.Controls("NumericComboBox5").Value
Tables("派车记录表").Current("实收现金")=e.form.Controls("NumericComboBox6").Value
Tables("派车记录表").Current("承运人姓名")=e.form.Controls("TextBox1").Value 
Tables("派车记录表").Current("运价描述")=e.form.Controls("ComboBox7").Value 
Tables("派车记录表").Current("身份驾驶证号")=e.form.Controls("TextBox2").Value 
Tables("派车记录表").Current("地址")=e.form.Controls("TextBox3").Value 
Tables("派车记录表").Current("驾驶员手机")=e.form.Controls("TextBox5").Value 
Tables("派车记录表").Current("驾驶员电话")=e.form.Controls("TextBox4").Value 
Tables("派车记录表").Current("车牌号")=e.form.Controls("TextBox9").Value 
Tables("派车记录表").Current("发票")=e.form.Controls("ComboBox9").value
Tables("派车记录表").Current("客户编号")=e.form.Controls("TextBox7").value
Tables("派车记录表").Current("运价描述")=e.form.Controls("ComboBox7").value
\'Tables("派车记录表").Current("承运人应结算")=e.form.Controls("NumericComboBox7").value

Tables("派车记录表").Current.Save()
Forms("派车开单").Close()

--  作者:lin_hailun
--  发布时间:2012/12/12 17:39:00
--  
 = 改成 is

--  作者:kmzb56
--  发布时间:2012/12/13 8:38:00
--  
我的意思是判断到是是空值时就返回,不要执行到保存的代码,按你的意思改了,但代码还是顺序执行到最后保存的地方了。没达到目录。 意思是看有没有跳出的代码。
[此贴子已经被作者于2012-12-13 8:41:42编辑过]

--  作者:lin_hailun
--  发布时间:2012/12/13 8:40:00
--  
 为空的时候返回,加一句return