|
-
Aug 25th, 1999, 04:35 PM
#1
Thread Starter
New Member
I need to operate on various recordsets.
rsShift1, rsShift2, rsShift3 are 3 Global recordsets which i need to update.
---------------------------------------------------------------------
For i = 1 To No_of_Shifts
STR = "FIRST"
s = "rsShift" & i ' If i do it this way 's' becomes a string 'ERROR'
Call Store_data(s, STR) ' Here s should be a recordset
........
........
Next
----------------------------------------------------------------------
Public Function Store_data(TableName As Recordset, Last_Val As String)
With TableName
...........
For i = 1 To no_of_tags
............
...........
next
..........
End With
End Function
----------------------------------------------------------------------
How do i pass the names of the recordsets to Store_data as recordsets ?
-
Aug 25th, 1999, 05:40 PM
#2
Lively Member
Hi,
Try putting your recordsets in a collection then reference the recordsets from the collection:
Private colRecordsets As New Collection
Private rs1 As DAO.Recordset
Private rs2 As DAO.Recordset
Private rs3 As DAO.Recordset
Private Sub test(tablename As DAO.Recordset)
MsgBox "it worked"
End Sub
Private Sub Command1_Click()
Dim tmprs As DAO.Recordset
For Each tmprs In colRecordsets
test tmprs
Next tmprs
End Sub
Private Sub Form_Load()
With colRecordsets
.Add rs1
.Add rs2
.Add rs3
End With
End Sub
The recordsets do not need to be DAO recordsets.
Hope this helps,
Preeti
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|