I would like to clear out all the records of a table using VB Code. I am building the table on the fly, so that I can cross reference it with my main table. The table consits of a multiple 3 digit numbers, depending on the check box the user clicks.
The DB name is FalconAnalysis, the table name is UnitSize and the only field in the table is Size. Here is the Code I am using, the first builds my array based on the check boxes, and the second part passes the values into my table as long as they are not zero.
-
Private Sub MakeFilter2()
-
-
If Nz(chkv2125S, False) Then _
-
SizeArray(0) = 150
-
If Nz(chkv2125H, False) Then _
-
SizeArray(1) = 151
-
If Nz(chkv215S, False) Then _
-
SizeArray(2) = 180
-
If Nz(chkv215H, False) Then _
-
SizeArray(3) = 181
-
If Nz(chkv2175S, False) Then _
-
SizeArray(4) = 210
-
If Nz(chkv2175H, False) Then _
-
SizeArray(5) = 211
-
If Nz(chkv220S, False) Then _
-
SizeArray(6) = 240
-
If Nz(chkv220H, False) Then _
-
SizeArray(7) = 241
-
If Nz(chkv225S, False) Then _
-
SizeArray(8) = 300
-
If Nz(chkv225H, False) Then _
-
SizeArray(9) = 301
-
-
End Sub
-
-
Private Sub boxxob_Click()
-
Dim intI As Integer
-
-
For intI = 0 To 9
-
Dim FalconAnalysis As Object
-
Dim tblUnitSize As Object
-
Dim colSize As Object
-
Set FalconAnalysis = CurrentDb
-
Dim UnitSize As Recordset
-
Set UnitSize = FalconAnalysis.OpenRecordset("UnitSize", dbOpenTable)
-
Dim strStringArray()
-
If SizeArray(intI) = 0 Then
-
Else
-
UnitSize.AddNew
-
UnitSize.Fields(0).Value = SizeArray(intI)
-
UnitSize.Update
-
UnitSize.Close
-
End If
-
Next
-
-
-
End Sub
-
If this is possible, or not, please let me know. I have been trying to use the Delete comand with no success. Thanks for the help.