Hi all,
I am relatively new to Access I am a perl and old DBase dabbler but find this 'stuff' fun also.
Anyway...
I am trying to open, read & right data between two recordsets simultaneously but am not sure how to call them both. I get an error telling me that there is no current record in the record set.
I have highlighted the trouble line below with "********"
Basically I have created one table with street names in one collum and numbers in another (one street name & one number per row) and am trying to loop through the first recordset and transpose the information into the next recordset running across (one street name lots of numbers per row)
Is it because I am declaring 2 x MyDb.OpenRecordsets ????
Any guidance will be greatly appreciated
Regards
Linctus
Private Sub Option0_Click()
Set MyDb = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDb.OpenRecordset("street down", DB_OPEN_TABLE)
Set MyNextTab = MyDb.OpenRecordset("street across", DB_OPEN_TABLE)
Dim Stname As String
Dim ColNo As Integer
MyTable.MoveFirst
Stname = MyTable![street]
Stname2 = MyTable![street]
*****MyNextTab.MoveFirst***** ' tells me no current records
Do While Not EOF("street down"
ColNo = 1
If Stname = Stname2 Then
MyNextTable.AddNew
MyNextTable![Street Name] = MyTable![street]
MyNextTable.Value("ColNo"
= MyTable![Number]
MyTable.MoveNext
ColNo = ColNo + 1
MyTable.Update
Else
Stname = MyTable![street]
Stname2 = MyTable![street]
ColNo = 1
End If
Loop
MyTable.Close
MyNextTab.Close
End Sub
I am relatively new to Access I am a perl and old DBase dabbler but find this 'stuff' fun also.
Anyway...
I am trying to open, read & right data between two recordsets simultaneously but am not sure how to call them both. I get an error telling me that there is no current record in the record set.
I have highlighted the trouble line below with "********"
Basically I have created one table with street names in one collum and numbers in another (one street name & one number per row) and am trying to loop through the first recordset and transpose the information into the next recordset running across (one street name lots of numbers per row)
Is it because I am declaring 2 x MyDb.OpenRecordsets ????
Any guidance will be greatly appreciated
Regards
Linctus
Private Sub Option0_Click()
Set MyDb = DBEngine.Workspaces(0).Databases(0)
Set MyTable = MyDb.OpenRecordset("street down", DB_OPEN_TABLE)
Set MyNextTab = MyDb.OpenRecordset("street across", DB_OPEN_TABLE)
Dim Stname As String
Dim ColNo As Integer
MyTable.MoveFirst
Stname = MyTable![street]
Stname2 = MyTable![street]
*****MyNextTab.MoveFirst***** ' tells me no current records
Do While Not EOF("street down"
ColNo = 1
If Stname = Stname2 Then
MyNextTable.AddNew
MyNextTable![Street Name] = MyTable![street]
MyNextTable.Value("ColNo"
MyTable.MoveNext
ColNo = ColNo + 1
MyTable.Update
Else
Stname = MyTable![street]
Stname2 = MyTable![street]
ColNo = 1
End If
Loop
MyTable.Close
MyNextTab.Close
End Sub