Re: Tricky Delete problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



>Well I could either delete them or not show them. Either way, if I were
>to use SQL programming, I am unfamilar as to how to do loops and pass
>variables in SQL.

Me too. I guess this explains why I wasn't understanding it - so you want to
output a line of data using code, rather than using a query to display the
results?

In theory, you should be able to loop around the fields in each record
returned with something like:
Dim oRS As Recordset
Dim iFld As Integer
Dim iCount As Integer
Dim oFld As Field

Set oRS = CurrentDb.OpenRecordset(sTableName, dbOpenTable)

iFld = 0
iCount = 0
For Each oFld In oRS.Fields
iCount = iCount + 1
If oFld.Value Is Not Null Then iFld = iFld + 1
Next oFld

That would give you the count of the last field with data in it, and then you
should be able to loop around the field until you get to that field. Unllike
that first bit, I don't have the code in a nearby database for me to post for
you - maybe someone else can continue with the next bit? Pseudocode-wise,
it'd look like:

For i = 1 to iCount
If i = 1 Then
sOutput = oRS.Fields(0)
Else
sOutput = sOutput & "," & oRS.Fields(i-1)
End If
Next i
write sOutput

or something like that...

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200511/1
.



Relevant Pages