RecordSetClone with OpenArgs

L

Lynn

I have a main form with a subform. On the subform you can
click on a button to open a popup form. The RegItemID
from the subform is being passed as a OpenArgs to the
popup form. The problem is the popup form won't open to
the correct RegItemID.

Here is the code on Open Event of the popup form.

If Not IsNull(Me.OpenArgs) Then
Dim RS As New ADODB.Recordset
Set RS = Me.Recordset.Clone

RS.Find "[RegItemID] = " & Me.OpenArgs

If RS.EOF = False Then
Me.Bookmark = RS.Bookmark
End If
Set RS = Nothing

Right now the popup form opens up to the first record or
ReqItemID = 1

Thanks
 
V

Vadim Rapp

L> I have a main form with a subform. On the subform
L> you can click on a button to open a popup form.
L> The RegItemID from the subform is being passed as a
L> OpenArgs to the popup form. The problem is the
L> popup form won't open to the correct RegItemID.

L> Here is the code on Open Event of the popup form.

L> If Not IsNull(Me.OpenArgs) Then
L> Dim RS As New ADODB.Recordset
L> Set RS = Me.Recordset.Clone

L> RS.Find "[RegItemID] = " & Me.OpenArgs

L> If RS.EOF = False Then
L> Me.Bookmark = RS.Bookmark
L> End If
L> Set RS = Nothing

L> Right now the popup form opens up to the first
L> record or ReqItemID = 1


how about this in the Open event:

Me.Controls("ReqItemID").SetFocus
DoCmd.FindRecord Me.OpenArgs, , , acSearchAll

Vadim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top