Microsoft Jet 数据库引擎找不到输入表或查询 '库存表'.确定它是否存在,以及它的名称的拼写是否正确 30
然后又弹出以下图片整个项目如下:PrivateSubcmbField_Click()cmbName.ClearAdodc1.RecordSource="select*fr...
然后又弹出以下图片
整个项目如下:
Private Sub cmbField_Click()
cmbName.Clear
Adodc1.RecordSource = "select * from 库存表”"
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
cmbName.AddItem Adodc1.Recordset.Fields(cmbField.Text)
Adodc1.Recordset.MoveNext
Loop
cmbName.Text = cmbName.List(0)
End Sub
Private Sub cmbName_Click()
Dim condition
condition = Trim(cmbField.Text)
If Adodc1.Recordset.Fields(condition).Type = 202 Then
Adodc1.RecordSource = "select * from 库存表 where" & condition & "= '" & cmbName.Text & " ' "
Else
Adodc1.RecordSource = " select * from 库存表 where" & condition & " = " & cmbName.Text
End If
Adodc1.Refresh
Val(txtno.Text) = Adodc1.Recordset.Fields("货物编号")
txtname.Text = Adodc1.Recordset.Fields("货物名称")
Val(txtstorenum.Text) = Adodc1.Recordset.Fields("库存量")
txtunit.Text = Adodc1.Recordset.Fields("单位")
End Sub
Private Sub cmdadd_Click()
On Error GoTo errorhandler:
If txtno.Text <> "" Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("货物编号") = Val(txtno.Text)
Adodc1.Recordset.Fields("货物名称") = txtname.Text
Adodc1.Recordset.Fields("库存量") = Val(txtstorenum.Text)
Adodc1.Recordset.Fields("单位") = txtunit.Text
Adodc1.Recordset.Update
cmbName.Clear
Adodc1.RecordSource = "select * from 库存表"
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
cmbName.AddItem Adodc1.Recordset.Fields(1)
Adodc1.Recordset.MoveNext
Loop
cmbField_Click
cmdclear_Click
Else
MsgBox "货物编号是主索引字段。不能为空。", , "错误提示"
End If
Exit Sub
errorhandler: MsgBox "货物编号是主索引,不能重复。", , "错误提示"
End Sub
Private Sub cmdclear_Click()
txtno.Text = ""
txtname.Text = ""
txtstorenum.Text = ""
txtunit.Text = ""
End Sub
Private Sub cmddel_Click()
If txtname.Text <> "" Then
Adodc1.RecordSource = "select * from 库存表 where 货物名称='" & txtname.Text & "'"
Adodc1.Refresh
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
cmbName.Clear
cmbField_Click
cmdclear_Click
End If
End Sub
Private Sub cmdedit_Click()
On Error GoTo errorhandler:
If txtno.Text <> "" Then
Adodc1.RecordSource = "select * from 库存表 where 货物编号 =" & txtno.Text
Adodc1.Refresh
Adodc1.Recordset.Fields("货物编号") = Val(txtno.Text)
Adodc1.Recordset.Fields("货物名称") = txtname.Text
Adodc1.Recordset.Fields("库存量") = Val(txtstorenum.Text)
Adodc1.Recordset.Fields("单位") = txtunit.Text
Else
MsgBox "货物编号是主索引字段。不能为空", , "错误提示"
End If
errorhandler: MsgBox "货物编号是主索引字段。不能重复", , "错误提示"
End Sub
Private Sub Form_Load()
Dim i As Integer
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 库存表"
Adodc1.Refresh
cmbField.Clear
For i = 0 To Adodc1.Recordset.Fields.Count - 1
cmbField.AddItem Adodc1.Recordset.Fields(i).Name
Next i
cmbField.Text = cmbField.List(0)
End Sub
我用ACCESS2003做了一个库存表.mdb 里面也有一个表叫库存表。求解。谢谢
Private Sub cmbName_Click() (注 提示这里出错) 这是第二个出现的问题 展开
整个项目如下:
Private Sub cmbField_Click()
cmbName.Clear
Adodc1.RecordSource = "select * from 库存表”"
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
cmbName.AddItem Adodc1.Recordset.Fields(cmbField.Text)
Adodc1.Recordset.MoveNext
Loop
cmbName.Text = cmbName.List(0)
End Sub
Private Sub cmbName_Click()
Dim condition
condition = Trim(cmbField.Text)
If Adodc1.Recordset.Fields(condition).Type = 202 Then
Adodc1.RecordSource = "select * from 库存表 where" & condition & "= '" & cmbName.Text & " ' "
Else
Adodc1.RecordSource = " select * from 库存表 where" & condition & " = " & cmbName.Text
End If
Adodc1.Refresh
Val(txtno.Text) = Adodc1.Recordset.Fields("货物编号")
txtname.Text = Adodc1.Recordset.Fields("货物名称")
Val(txtstorenum.Text) = Adodc1.Recordset.Fields("库存量")
txtunit.Text = Adodc1.Recordset.Fields("单位")
End Sub
Private Sub cmdadd_Click()
On Error GoTo errorhandler:
If txtno.Text <> "" Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("货物编号") = Val(txtno.Text)
Adodc1.Recordset.Fields("货物名称") = txtname.Text
Adodc1.Recordset.Fields("库存量") = Val(txtstorenum.Text)
Adodc1.Recordset.Fields("单位") = txtunit.Text
Adodc1.Recordset.Update
cmbName.Clear
Adodc1.RecordSource = "select * from 库存表"
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
cmbName.AddItem Adodc1.Recordset.Fields(1)
Adodc1.Recordset.MoveNext
Loop
cmbField_Click
cmdclear_Click
Else
MsgBox "货物编号是主索引字段。不能为空。", , "错误提示"
End If
Exit Sub
errorhandler: MsgBox "货物编号是主索引,不能重复。", , "错误提示"
End Sub
Private Sub cmdclear_Click()
txtno.Text = ""
txtname.Text = ""
txtstorenum.Text = ""
txtunit.Text = ""
End Sub
Private Sub cmddel_Click()
If txtname.Text <> "" Then
Adodc1.RecordSource = "select * from 库存表 where 货物名称='" & txtname.Text & "'"
Adodc1.Refresh
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
cmbName.Clear
cmbField_Click
cmdclear_Click
End If
End Sub
Private Sub cmdedit_Click()
On Error GoTo errorhandler:
If txtno.Text <> "" Then
Adodc1.RecordSource = "select * from 库存表 where 货物编号 =" & txtno.Text
Adodc1.Refresh
Adodc1.Recordset.Fields("货物编号") = Val(txtno.Text)
Adodc1.Recordset.Fields("货物名称") = txtname.Text
Adodc1.Recordset.Fields("库存量") = Val(txtstorenum.Text)
Adodc1.Recordset.Fields("单位") = txtunit.Text
Else
MsgBox "货物编号是主索引字段。不能为空", , "错误提示"
End If
errorhandler: MsgBox "货物编号是主索引字段。不能重复", , "错误提示"
End Sub
Private Sub Form_Load()
Dim i As Integer
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 库存表"
Adodc1.Refresh
cmbField.Clear
For i = 0 To Adodc1.Recordset.Fields.Count - 1
cmbField.AddItem Adodc1.Recordset.Fields(i).Name
Next i
cmbField.Text = cmbField.List(0)
End Sub
我用ACCESS2003做了一个库存表.mdb 里面也有一个表叫库存表。求解。谢谢
Private Sub cmbName_Click() (注 提示这里出错) 这是第二个出现的问题 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询