kepperlepperkeffer
Programmer
Hello Everyone!
I wonder if you can help me. My code below opens, naviagtes, then
closes a recordset. And it works. The only problem is, that I want
the LocateSegment function to find the NEXT value in th recordset, but
all it keeps doing is finding the FIRST. Its as if theres an
imaginary line at the beginning of the LocateSegment function saying
RecordsetIP.MoveFirst
Can you help? I've tried using RecordsetIP.FindNext but it errors
saying "the operateion is not supported for this type of object.
Any ideas would be massively appreciated.
Cheers!
Graeme.
Option Explicit
Dim db As DAO.Database
Dim RecordsetIP As DAO.Recordset 'Input table
Public Function OpenConnections()
Set db = CurrentDb
Set RecordsetIP = db.OpenRecordset("EDI Raw Input"
RecordsetIP.MoveFirst
End Function
Public Function LocateSegment(Segment As String)
Do Until RecordsetIP![Col1] = Segment Or RecordsetIP.EOF = True
RecordsetIP.MoveNext
Loop
End Function
Public Function CloseConnections()
RecordsetIP.Close
Set RecordsetIP = Nothing
db.Close
Set db = Nothing
End Function
Private Sub Form_Load()
OpenConnections
LocateSegment ("LIN"
'search recordset for NEXT occurance of
"LIN"
MsgBox RecordsetIP("Col2"
LocateSegment ("LIN"
MsgBox RecordsetIP("Col2"
LocateSegment ("LIN"
MsgBox RecordsetIP("Col2"
' RecordsetIP.FindNext ("IMD"
'causes error
CloseConnections
End Sub
I wonder if you can help me. My code below opens, naviagtes, then
closes a recordset. And it works. The only problem is, that I want
the LocateSegment function to find the NEXT value in th recordset, but
all it keeps doing is finding the FIRST. Its as if theres an
imaginary line at the beginning of the LocateSegment function saying
RecordsetIP.MoveFirst
Can you help? I've tried using RecordsetIP.FindNext but it errors
saying "the operateion is not supported for this type of object.
Any ideas would be massively appreciated.
Cheers!
Graeme.
Option Explicit
Dim db As DAO.Database
Dim RecordsetIP As DAO.Recordset 'Input table
Public Function OpenConnections()
Set db = CurrentDb
Set RecordsetIP = db.OpenRecordset("EDI Raw Input"
RecordsetIP.MoveFirst
End Function
Public Function LocateSegment(Segment As String)
Do Until RecordsetIP![Col1] = Segment Or RecordsetIP.EOF = True
RecordsetIP.MoveNext
Loop
End Function
Public Function CloseConnections()
RecordsetIP.Close
Set RecordsetIP = Nothing
db.Close
Set db = Nothing
End Function
Private Sub Form_Load()
OpenConnections
LocateSegment ("LIN"
"LIN"
MsgBox RecordsetIP("Col2"
LocateSegment ("LIN"
MsgBox RecordsetIP("Col2"
LocateSegment ("LIN"
MsgBox RecordsetIP("Col2"
' RecordsetIP.FindNext ("IMD"
CloseConnections
End Sub