| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 253 人关注过本帖
标题:新手求助
只看楼主 加入收藏
Adon
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-7-28
收藏
 问题点数:0 回复次数:0 
新手求助
模块代码:
Private Sub cmdEXIT_Click()
Unload Me
End Sub

Private Sub cmdSAVA_Click()
'数据校验~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'If txtopendate.Text = "" Then
   'MsgBox "开户日期不能为空!", 48, "错误提示"
   'txtopendate.SetFocus
   'Exit Sub
'End If
'If txtcstname.Text = "" Then
   'MsgBox "联系人不能为空!", 48, "错误提示"
   'txtcstname.SetFocus
   'Exit Sub
'End If
If txtYHDH.Text = "" And txtYHSJ.Text = "" Then
   MsgBox "填写电话号码了吗?", 48, "错误提示"
   txtYHDH.SetFocus
   Exit Sub
End If
If txtZJXH.Text = "" Then
    MsgBox "主机型号不能为空!", 48, "错误提示"
   txtZJXH.SetFocus
   Exit Sub
End If
If txtZJBH.Text = "" Then
    MsgBox "主机编号不能为空!", 48, "错误提示"
   txtZJBH.SetFocus
   Exit Sub
End If


'添加数据~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Call OpenConn
  sql = "select * from cstid"
  rs.Open sql, cn, 3, 3
  rs.AddNew
    rs.Fields("id") = txtcstid.Text
    rs.Fields("lxr") = txtcstname.Text
    rs.Fields("pym") = txtPYM.Text
    rs.Fields("yhlx") =
    rs.Fields("yhdw") = txtYHDW.Text
    rs.Fields("yhdz") = txtYHDZ.Text
    rs.Fields("yzbm") = txtYZBM.Text
    rs.Fields("yhdh") = txtYHDH.Text
    rs.Fields("yhsj") = txtYHSJ.Text
    rs.Fields("zjxh") = txtZJXH.Text
    rs.Fields("zjbh") = txtZJBH.Text
    rs.Fields("xsqxh") = txtXSQXH.Text
    rs.Fields("xsqbh") = txtXSQBH.Text
    rs.Fields("gjrq") = txtopendate.Text
    rs.Fields("jdr") = txtoptor.Text
    rs.Fields("bz") = txtBZ.Text
  rs.Update
Call CloseConn
'保存结束~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
   '更新formZY listview~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
FormZY.cmdcx = True
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
   Call atnum
   txtcstname.Text = ""
   txtPYM.Text = ""
   
   txtYHDW.Text = ""
   txtYHDZ.Text = ""
   txtYZBM.Text = ""
   txtYHDH.Text = ""
   txtYHSJ.Text = ""
   txtZJXH.Text = ""
   txtZJBH.Text = ""
   txtXSQXH.Text = ""
   txtXSQBH.Text = ""
   txtopendate.Text = ""
   txtBZ.Text = ""
    "个人"
    "单位"
   txtZJBH.BackColor = &H80000005
   

End Sub

Private Sub Form_Load()
'添加下拉列表~~~~~~~~~~~~~~~~~
   "家庭"
   "机关"
   "团体"
   "经销商"
'自动编号~~~~~~~~~~~~~~
Call atnum
  Me.Picture1.Picture = LoadPicture(App.Path & "\bg\bg3.bmp")
  Me.Caption = sysname
  Me.Icon = FormZY.Icon
  txtoptor.Text = optor
End Sub



Private Sub txtopendate_LostFocus()
'~~~~~~~~~~日期格式~~~~~~~~~~~~~~~~
If IsDate(txtopendate.Text) Then
  txtopendate = Format(txtopendate.Text, "yyyy-mm-dd")
Else
  txtopendate = ""
End If
End Sub



Private Sub txtcstname_LostFocus()
'获得用户名拼音码~~~~~~~~~~~~~~~~~~~`
Dim a As Integer
txtPYM.Text = ""
a = Len(txtcstname.Text)
For i = 1 To a
    txtPYM.Text = txtPYM.Text & py(Mid(txtcstname.Text, i, 1))
Next i
End Sub

Private Sub txtZJBH_Change()
'~~~~~~~~~~~~~验证文本有效性~~~~~~~~~~~~~~~~~~~~
If Len(txtZJBH.Text) = 16 Or Len(txtZJBH.Text) = 18 Then
   txtZJBH.BackColor = &H80000005
Else
   txtZJBH.BackColor = &H80C0FF
End If
End Sub

Private Sub txtZJBH_GotFocus()
'~~~~~~~~~~~~~验证文本有效性~~~~~~~~~~~~~~~~~~~~
If Len(txtZJBH.Text) = 16 Or Len(txtZJBH.Text) = 18 Then
   txtZJBH.BackColor = &H80000005
Else
   txtZJBH.BackColor = &H80C0FF
End If
End Sub


Private Sub atnum()
'自动编号~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Call OpenConn
sql = "select id from cstid ORDER BY id"
rs.Open sql, cn, 1, 1
  If rs.RecordCount > 0 Then
     rs.MoveLast
     txtcstid.Text = "zy" & Format(Val(Right(rs.Fields("id"), 5) + 1), "0000")
  Else
     txtcstid.Text = "zy0001"
  End If
Call CloseConn
End Sub
------------------------------------------
出错语句:txtcstid.Text = "zy" & Format(Val(Right(rs.Fields("id"), 5) + 1), "0000")
错误13:类型不匹配
请高手指教,在线等,谢谢
搜索更多相关主题的帖子: 联系人 电话 
2008-07-28 00:28
快速回复:新手求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032692 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved