|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
在VB6 中的代码,到最后一句(ADOcn.Execute strSql)提示:最后一个参数没有被指定值。不知道问题在哪,请高手指教
Private Sub Com_Click()
Dim strCldl, strLb, strMc, strXh, strCs, strDw, strLy, strJsr, strBz As String
Dim sngSl, sngDj, sngJe As Single
Dim dRkrq As Date
Dim strSql As String
If CmbCldl.Text = "" Then
MsgBox "材料大类未填写"
CmbCldl.SetFocus
Exit Sub
Else
strCldl = Trim(CmbCldl.Text)
End If
If CmbLb.Text = "" Then
MsgBox "材料小类未填写"
CmbLb.SetFocus
Exit Sub
Else
strLb = Trim(CmbLb.Text)
End If
If CmbMc.Text = "" Then
MsgBox "材料名称未填写"
CmbMc.SetFocus
Exit Sub
Else
strMc = Trim(CmbMc.Text)
End If
strXh = Trim(CmbXh.Text)
strCs = Trim(CmbCs.Text)
If TxtSl.Text = "" Then
MsgBox "数量未填写"
sngSl.SetFocus
Exit Sub
Else
sngSl = Val(TxtSl.Text)
End If
If CmbDw.Text = "" Then
MsgBox "单位未填写"
CmbDw.SetFocus
Exit Sub
Else
strDw = Trim(CmbDw.Text)
End If
sngDj = Val(TxtDj.Text)
sngJe = sngSl * sngDj
If CmbLy.Text = "" Then
MsgBox "材料来源未填写"
CmbLy.SetFocus
Exit Sub
Else
strLy = Trim(CmbLy.Text)
End If
If CmbJsr.Text = "" Then
CmbJsr.SetFocus
Exit Sub
Else
strJsr = Trim(CmbJsr.Text)
End If
dRkrq = TxtRq.Text
strBz = Trim(txtBz.Text)
strSql = "insert into rukub(cailfl, leib, mingc, xingh, changs, shul, danw, danj, jine, laiy, jingsr, rukrq, beiz) " & _
"values(strCldl, strLb, strMc, strXh, strCs, sngSl, strDw, sngDj, sngJe, strLy, strJsr, dRkrq, strBz)"
StrAccess = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\Young\My Documents\gcgl\startimes.accdb;Persist Security Info=False"
Set ADOcn = New ADODB.Connection ' 赋值变量为对象引用
ADOcn.Open StrAccess '打开连接
ADOcn.Execute strSql
End Sub |
|