TheAceMan1
Programmer
Howdy All . . .
The following is a function setup to repeat a problem that shows BOF stays true:
Take note of the [purple]debug[/purple] statenments. The function is called by the following code in a command button but1.
x is simply existing values in an autonumber field Named [blue]ID[/blue]. Note when the button is clicked the immediate window reveals the following:
In the function I close and set rst to nothing, then on successive calls I dim and set a recordsetclone. Microsoft says the folowing in help for a recordsetclone:
Can someone tell me why BOF is true on successive calls? ...
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see faq219-2884 [blue]Worthy Reading![/blue]
Also faq181-2886 [blue]Worthy Reading![/blue]
The following is a function setup to repeat a problem that shows BOF stays true:
Code:
[blue]Public Function qTest(ID As Long) As Boolean
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
[purple][b]Debug.Print[/b][/purple] ID & " StartBOF = " & rst.BOF;
If Not rst.BOF Then
rst.MovePrevious
[purple][b]Debug.Print[/b][/purple] " PrevBOF = " & rst.BOF;
End If
[purple][b]Debug.Print[/b][/purple]
rst.Close
Set rst = Nothing
End Function[/blue]
Code:
[blue]Private Sub but1_Click()
Dim x As Long
For x = 1 To 4
DoEvents
qTest x
Next
End Sub[/blue]
Code:
[blue]1 StartBOF = False PrevBOF = True
2 StartBOF = True
3 StartBOF = True
4 StartBOF = True
1 StartBOF = True
2 StartBOF = True
3 StartBOF = True
4 StartBOF = True[/blue]
Microsoft said:[blue]When a new Recordset object is opened, its first record is the current record.[/blue]
Can someone tell me why BOF is true on successive calls? ...
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see faq219-2884 [blue]Worthy Reading![/blue]
Also faq181-2886 [blue]Worthy Reading![/blue]