I. Call method: SubAcchelp_Test () if the condition is long-integer CallAccHelp_DeleteFldNumRow (Table Name, field name, condition) if the condition is text-type CallAccHelp_DeleteFldStrRow (Table Name, field name, condition) endSub 2. two functions: PublicFunction
I. Call method: Sub Acchelp_Test () 'If the condition is a long integer Call AccHelp_DeleteFldNumRow ("table name", "field name", condition) 'If the condition is text type 'call AccHelp_DeleteFldStrRow ("table name", "field name", condition) End Sub 2. two functions: Public Function
I. Call method:
Sub Acchelp_Test ()
'If yesConditionIs a long integer
Call AccHelp_DeleteFldNumRow ("table name ","FieldName ",Condition)
'If yesConditionIs text type
'Call AccHelp_DeleteFldStrRow ("table name ","FieldName ",Condition)
End Sub
Ii. TwoFunction:
Public Function AccHelp_DeleteFldStrRow (tblName As String, conditionFldName As String, strCondition As String)
'Function: according toFieldConditionDeleteA tableFieldYesCondition(Must be text) The whole lineRecordTo reference DAO3.6.
'Generally, it is used based on the text order number (or contract number ).DeleteOne in the tableRecord, OrDeleteYesConditionMultipleRecord
'Modification history: 2006/1/3
'Note:
'Tblname indicates the table name.
'Conditionfldname refers to the applicationConditionFieldName
'Strcondition refersCondition
'Author: Zhu Di (Microsoft's most valuable expert)
'Note: You can apply this in your own software for free.FunctionIn order to respect the work of the author, please keep these instructions. At the same time, you may not use it for profitable commercial purposes. You are welcome to submit your comments for modification andFunctionCommunicate with author
'Mail: admin@accessoft.com
On Error GoTo Err_AccHelp_DeleteFldStrRow:
Dim strSQL As String
Dim rst As DAO. Recordset
Set rst = CurrentDb. OpenRecordset (tblName, dbOpenDynaset)
Rst. MoveFirst
Do Until rst. EOF
If rst (conditionFldName) = strCondition Then
Rst. Delete
End If
Rst. MoveNext
Loop
Rst. Close
Set rst = Nothing
Exit_AccHelp_DeleteFldStrRow:
Exit Function
Err_AccHelp_DeleteFldStrRow:
Rst. Close
Set rst = Nothing
Resume Exit_AccHelp_DeleteFldStrRow
End Function
Public Function AccHelp_DeleteFldNumRow (tblName As String, conditionFldName As String, NumCondition As Long)
'Function: according toFieldConditionDeleteA tableFieldYesCondition(Must be a long integer number ).RecordTo reference DAO3.6.
'Is generally used according to the serial numberDeleteOne in the tableRecord, OrDeleteYesConditionMultipleRecord
'Modification history: 2006/1/3
'Note:
'Tblname indicates the table name.
'Conditionfldname refers to the applicationConditionFieldName
'Numcondition refersCondition
'Author: Zhu Di (Microsoft's most valuable expert)
'Note: You can apply this in your own software for free.FunctionIn order to respect the work of the author, please keep these instructions. At the same time, you may not use it for profitable commercial purposes. You are welcome to submit your comments for modification andFunctionCommunicate with author
'Mail: admin@accessoft.com
On Error GoTo Err_AccHelp_DeleteFldNumRow:
Dim strSQL As String
Dim rst As DAO. Recordset
Set rst = CurrentDb. OpenRecordset (tblName, dbOpenDynaset)
Rst. MoveFirst
Do Until rst. EOF
If rst (conditionFldName) = NumCondition Then
Rst. Delete
End If
Rst. MoveNext
Loop
Rst. Close
Set rst = Nothing
Exit_AccHelp_DeleteFldNumRow:
Exit Function
Err_AccHelp_DeleteFldNumRow:
Rst. Close
Set rst = Nothing
Resume Exit_AccHelp_DeleteFldNumRow
End Function
Reference self-Webmaster network http://www.software8.co/shujuku/access/2395.html