View Full Version : updating the first 6 records in a table


diversoln
11-03-2001, 01:21 PM
After a series of queries, I'd like to export the resulting table to Excel to graph the data. I'd like to include a "descriptors" field in the table that show the settings that were used as criteria to form this table. I have six strings that I would like to reside in the "descriptors" field in the first six records of the table.

I'm thinking that I'd like to set up a loop that will update the records starting at the top of the file. Is there a way to do this ?

Thanks for any advice you can offer...

diversoln
11-03-2001, 02:54 PM
I've been working with this for a while and have come up with the following, but something is still missing - any ideas ?


Dim rst As Recordset
Dim strarray(6, 1) As String
Dim counter As Integer
Dim dbs As Database


strarray(1, 1) = str1
strarray(2, 1) = str2
strarray(3, 1) = str3
strarray(4, 1) = str4
strarray(5, 1) = str5
strarray(6, 1) = str6

counter = 1
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("All_WOs", dbOpenDynaset)

With rst
.MoveFirst

Do While counter < 7
.Edit
!descriptors = strarray(counter, 1)
counter = counter + 1
rst.MoveNext
Loop

End With

Pat Hartman
11-04-2001, 11:30 AM
Since the descriptor records contain a different type of data than the other records, they do not belong in the same table. Store the descriptors in a separate table. If you want them exported to Excel as part of the same recordset, use a union query and export the union query rather than the table.

diversoln
11-04-2001, 01:39 PM
Thanks Pat - I agree that its the way to go http://www.access-programmers.co.uk/ubb/smile.gif

Have a great day.