End Select
End Sub
其中“新增”记录和“修改”记录界面代码设计如下:
Private Sub Form_Resize()
UpDown1.Value = Txt_dgsl.Text
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim sql As String, rtn As Long
Select Case Button.Index
Case 3
If Trim(Txt_zdbh.Text) = "" Or Trim(Txt_tsid.Text) = "" Then
MsgBox "请填写相关信息!", vbOKOnly + vbInformation, "提示"
Exit Sub
End If
If Me.Caption = "图书征订添加" Then
sql = "insert into 图书征订 values('" + Trim(Txt_zdbh.Text) + "','" _
+ Trim(Txt_tsid.Text) + "','" + Trim(Txt_dgname.Text) + "','" _
+ Trim(Txt_lxfs.Text) + "','" + Trim(Txt_dgsl.Text) + "','" _
+ Trim(Txt_dgdj.Text) + "','" + Trim(Dtpk_dgrq.Value) + "','" _
+ Trim(Cmb_sfys.Text) + "','" + Trim(Dtpk_ysrq.Value) + "','" _
+ Trim(Cmb_czy.Text) + "','" + Trim(Txt_bz.Text) + "')"
Else
sql = "update 图书征订 set 征订编号='" + Trim(Txt_zdbh.Text) _
+ "',图书ID='" + Trim(Txt_tsid.Text) _
+ "',订购者='" + Trim(Txt_dgname.Text) + "',订购者联系方式='" _
+ Trim(Txt_lxfs.Text) + "',订购数量='" _
+ Trim(Txt_dgsl.Text) + "',订购单价='" _
+ Trim(Txt_dgdj.Text) + "',订购日期='" _
& Me.Dtpk_dgrq.Value & "',是否验收='" _
+ Trim(Cmb_sfys.Text) + "',验收日期='" _
& Me.Dtpk_ysrq.Value & "',操作员='" _
+ Trim(Cmb_czy.Text) + "',备注='" _
+ Trim(Txt_bz.Text) + "' where 征订编号='" _
+ Frm_zdsz.MSFlexGrid1.TextMatrix(Frm_zdsz.MSFlexGrid1.Row, 0) _
+ "'"
End If
rtn = Update(sql)
If rtn = 0 Then
If Me.Caption = "图书征订添加" Then
MsgBox "图书征订信息添加成功!", vbOKOnly + vbInformation, "提示"
Else
MsgBox "图书征订信息修改成功!", vbOKOnly + vbInformation, "提示"
End If
sql = "select * from 图书征订"
ShowData sql, Frm_zdsz.MSFlexGrid1
Unload Me
ElseIf rtn = -2147217873 Then
MsgBox "征订编号已存在!请重新输入!", vbOKOnly + vbExclamation, "警告"
Txt_zdbh.Text = ""
Txt_zdbh.SetFocus
ElseIf rtn = -2147217833 Then
MsgBox "输入信息超过指定长度!请重新输入!", vbOKOnly + vbExclamation, "警告"
ElseIf rtn = -2147217900 Then
MsgBox "请不要输入单引号等非法字符!", vbOKOnly + vbExclamation, "警告"
Else
MsgBox "出现系统错误!请重启本系统!", vbOKOnly + vbExclamation, "警告"
End If
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>