|
改一下模块中的程序就可以了,注意你使用的是DAO模式Option Compare Database
Function AddToList(strTable As String, strField As String, _
strData As String) As Integer
' Add item to table
' Returns acDataErrAdded if successful,
' acDataErrDisplay on any error
Dim db As Database
Dim strSQL As String
Set db = CurrentDb
strSQL = "Insert into " & strTable & " (" & strField & ") Values " _
& "('" & strData & "')"
Set db = CurrentDb
db.Execute strSQLExitHere:
AddToList = acDataErrAdded
Exit FunctionHandleErr:
AddToList = acDataErrDisplay
Select Case Err
Case Else
MsgBox Err & ": " & Err.Description, , _
"Form_HouseholdInventory.AddToList()"
End Select
Resume ExitHere
End Function
|
|