代码如下
Private Sub OKButton_Click()
If cmbTable_proj.Text = "" Then
MsgBox "未选择项目号!"
ElseIf cmbTable_inv.Text = "" Then
MsgBox "未选择发票代码!"
Else
'判断选择的报表是否有内容
Dim sg As AdoInterface.AdoValueSet
Set sg = db.GetValueSet("select *from fmttxt_item where proj_code='" & get_num(cmbTable_proj) & "' and fmt_code='" & get_num(cmbTable_inv) & "'")
If Not sg.GetRecordSet.EOF Then
'正确输入的情况处理
Dim sf As AdoInterface.AdoValueSet
Set sf = db.GetValueSet("select * from fmttxt_item where proj_code='" & ProjCode & "' and tradecode='" & TradeCode & "' and fmt_code='" & FmtCode & "'")
If Not sf.GetRecordSet.EOF Then
Dim X As Integer
X = MsgBox("此操作会覆盖该发票原内容,是否继续?!", vbYesNoCancel)
If X = vbNo Then
Me.Hide
Exit Sub
ElseIf X = vbCancel Then
Me.Hide
Exit Sub
Else
Me.Hide
End If
End If
'更新发票格式
Dim sqlstr As String
sqlstr = "Select '" & ProjCode & "','" & TradeCode & "','" & FmtCode & "',itemno,itemname,itemdesc,fieldtype,itemlen,funcname,funcpara,extinfo,loopnum,linelevel,fldrow,fldcol,loopx,loopy from fmttxt_item where proj_code='" & get_num(cmbTable_proj) & "' and fmt_code='" & get_num(cmbTable_inv) & "'"
db.Delete "fmttxt_item", "proj_code='" & ProjCode & "' and tradecode='" & TradeCode & "' and fmt_code='" & FmtCode & "'"
db.InsertRecord "fmttxt_item", sqlstr
Else
MsgBox "您选择的发票没有内容!"
End If
End If
End Sub
当我测试时候,弹出您选择的发票没有内容之后,要点两次确定按钮才能正确显示,其实我觉得点一次就已经提交了,只是不知道什么原因还要再点一次,
Private Sub OKButton_Click()
If cmbTable_proj.Text = "" Then
MsgBox "未选择项目号!"
ElseIf cmbTable_inv.Text = "" Then
MsgBox "未选择发票代码!"
Else
'判断选择的报表是否有内容
Dim sg As AdoInterface.AdoValueSet
Set sg = db.GetValueSet("select *from fmttxt_item where proj_code='" & get_num(cmbTable_proj) & "' and fmt_code='" & get_num(cmbTable_inv) & "'")
If Not sg.GetRecordSet.EOF Then
'正确输入的情况处理
Dim sf As AdoInterface.AdoValueSet
Set sf = db.GetValueSet("select * from fmttxt_item where proj_code='" & ProjCode & "' and tradecode='" & TradeCode & "' and fmt_code='" & FmtCode & "'")
If Not sf.GetRecordSet.EOF Then
Dim X As Integer
X = MsgBox("此操作会覆盖该发票原内容,是否继续?!", vbYesNoCancel)
If X = vbNo Then
Me.Hide
Exit Sub
ElseIf X = vbCancel Then
Me.Hide
Exit Sub
Else
Me.Hide
End If
End If
'更新发票格式
Dim sqlstr As String
sqlstr = "Select '" & ProjCode & "','" & TradeCode & "','" & FmtCode & "',itemno,itemname,itemdesc,fieldtype,itemlen,funcname,funcpara,extinfo,loopnum,linelevel,fldrow,fldcol,loopx,loopy from fmttxt_item where proj_code='" & get_num(cmbTable_proj) & "' and fmt_code='" & get_num(cmbTable_inv) & "'"
db.Delete "fmttxt_item", "proj_code='" & ProjCode & "' and tradecode='" & TradeCode & "' and fmt_code='" & FmtCode & "'"
db.InsertRecord "fmttxt_item", sqlstr
Else
MsgBox "您选择的发票没有内容!"
End If
End If
End Sub
当我测试时候,弹出您选择的发票没有内容之后,要点两次确定按钮才能正确显示,其实我觉得点一次就已经提交了,只是不知道什么原因还要再点一次,
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货