C
Craig Buchanan
I have a form that is bound to a recordset during the form's OnOpen event
(see code below). This seems to work correctly in most cases. When I try
to open the form to add a record, it doesn't behave as i would expect. From
another form, I use:
DoCmd.OpenForm "Form1", , , , acFormAdd
When Form1 opens, I see all 1000+ records, when I only want to see one
record (the new record).
What am I missing?
Thanks,
Craig Buchanan
<code>
Private Sub Form_Open(Cancel As Integer)
Dim RS As New ADODB.Recordset
With RS
'connect to SQL Server
.ActiveConnection = g_Application.GetConnection
.Source = "SELECT * FROM MY_TABLE "
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With
Set Me.Recordset = RS
Set RS = Nothing
End Sub
</code>
(see code below). This seems to work correctly in most cases. When I try
to open the form to add a record, it doesn't behave as i would expect. From
another form, I use:
DoCmd.OpenForm "Form1", , , , acFormAdd
When Form1 opens, I see all 1000+ records, when I only want to see one
record (the new record).
What am I missing?
Thanks,
Craig Buchanan
<code>
Private Sub Form_Open(Cancel As Integer)
Dim RS As New ADODB.Recordset
With RS
'connect to SQL Server
.ActiveConnection = g_Application.GetConnection
.Source = "SELECT * FROM MY_TABLE "
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With
Set Me.Recordset = RS
Set RS = Nothing
End Sub
</code>