以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  Object variable or With block variable not set.  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=55819)

--  作者:zhchling
--  发布时间:2014/8/23 19:29:00
--  Object variable or With block variable not set.

在添加客户信息到数据库时,发生错误。

 

Object variable or With block variable not set.

 

这是什么意思 ?

 

 

错误提示如下:

.NET Framework 版本:2.0.50727.3053
Foxtable 版本:2014.8.24.1
错误所在事件:窗口,录入新客户,TextBoxname,ValueChanged
详细错误信息:
Object variable or With block variable not set.


 

 

情况说明:

 

  TextBoxname  的,ValueChanged事件里的代码是:

If e.Form.Controls("TextBoxname").value.Contains(",") Then
    e.Form.Controls("TextBoxname").value=e.Form.Controls("TextBoxname").value.Replace(",","/")
End If

 

添加客户到数据库的按钮里的代码是:

 

With Tables("userb")
    .Position = .Rows.Count - 1
End With


 r("city") = e.form.controls("combobox6").value
 r("name") = e.form.controls("textboxname").value

 r("zcldidariqi") = e.form.controls("DateTimePicker1").value

 r("zclshouji") = e.form.controls("textboxzclshouji").Text
 r("zclrenshu") = e.form.controls("comboboxzclrenshu").Text
 r("renzhu") = e.form.controls("comboboxzclrenzhu").value
 r("telphone") = e.form.controls("textbox6").Text
 r("zclqq") = e.form.controls("textbox7").Text
 r("zclmsn") = e.form.controls("textbox8").Text
 r("zcldazhiriqi") = e.form.controls("textboxdazhiriqi").text
 r("sex") = e.form.controls("comboboxsex").value
 r("zclqueren") = e.form.controls("comboboxzclqueren").value
 r("zclxianlu") = e.form.controls("combobox1").value
r("zclhotel") = e.form.controls("comboxhotel").value  \'写入房型要求
r("zclhotelname") = e.form.controls("comboxhotelname").value \'写入宾馆名
 r("zclzuijincity") = e.form.controls("combobox7").value

 r("zcldidacity") = e.form.controls("comboboxzclcity").value
 r("zclcheci") = e.form.controls("comboboxcheci").value
 r("daipairicheng") = False
 r("daipaifang") = False
 r("zcldidariqiqueding") = e.form.controls("CheckBox1").checked
 r("didian") = e.form.controls("comboboxdidian").value
 r("bumen") = user.Group
 r("zcltianjiaren") = user.name
 r("regdate") = now()

 r("来源") = e.form.controls("comboboxdingfanglaiyuan").value
 r("lianxichengdu") = e.form.controls("comboboxlianxichengdu").value

 r("zclbeizhu") = e.form.controls("textboxbeizhu").text & vbcrlf  &    User.Name & " " & Date.Now  &  "添加了这个客户"

 

[此贴子已经被作者于2014-8-23 20:33:30编辑过]

--  作者:有点甜
--  发布时间:2014/8/24 14:29:00
--  

这样写代码

 

If e.Sender.Text <> Nothing AndAlso e.Sender.Contains(",") Then
    e.Sender.Text = e.Sender.Text.Replace(",","/")
End If

[此贴子已经被作者于2014-8-24 14:28:54编辑过]