Deleting Query table with an array

Vincen85

Registered User.
Local time
Today, 11:14
Joined
Mar 5, 2008
Messages
10
Hi, I have a problem deleting a specific row and field that my query have.

What I want to do is mainly delete a specific rows in the my Query table that has : Field 1, Field 2, Field 3, Field4

what i tried to do was doing is create and array that loop through the Query table and check in field 1 for a certain value and if that certain value appears I want to delete that row: for example

Code:
Dim IntRow As Integer
Dim IntCol As Integer
Dim varData As Variant


For IntCol = 0 To numFields Step 1
     For IntRow = 0 To numRows Step 1
    If (rst.EOF = False) Then
    'Check Field 1 for value 47-72 to delete
    Else
    If (varData(0,IntRow) > 47 And varData(0,IntRow) < 72) Then
    varData(IntCol, IntRow).Delete
    End If
    End If
     Next IntRow
 Next IntCol


In the example Above my syntax is not correct for :
If (varData(0,IntRow) > 47 And varData(0,IntRow) < 72)
and for varData(IntCol, IntRow).Delete.

can anyone help me to find the exact syntax i need to use to execute the program above?

THANK YOU!
 
Last edited:
Hi, I have a problem deleting a specific row and field that my query have.

What I want to do is mainly delete a specific rows in the my Query table that has : Field 1, Field 2, Field 3, Field4

what i tried to do was doing is create and array that loop through the Query table and check in field 1 for a certain value and if that certain value appears I want to delete that row: for example

Code:
Dim IntRow As Integer
Dim IntCol As Integer
Dim varData As Variant


For IntCol = 0 To numFields Step 1
     For IntRow = 0 To numRows Step 1
    If (rst.EOF = False) Then
    'Check Field 1 for value 47-72 to delete
    Else
    If (varData(0,IntRow) > 47 And varData(0,IntRow) < 72) Then
    varData(IntCol, IntRow).Delete
    End If
    End If
     Next IntRow
 Next IntCol


In the example Above my syntax is not correct for :
If (varData(0,IntRow) > 47 And varData(0,IntRow) < 72)
and for varData(IntCol, IntRow).Delete.

can anyone help me to find the exact syntax i need to use to execute the program above?

THANK YOU!
Here is a link to Microsoft SQL Look at DELETE sql
with Where clause
http://msdn2.microsoft.com/en-us/library/aa140011(office.10).aspx#acfundsql_dml
 
Thank you! It works like a charm!
 

Users who are viewing this thread

Back
Top Bottom