Oper Arges

J

johnb

Hi All
I have a Access 2003 Form with a subform, which in turn has a subform. the
Sub-Subform is a datasheet view. I need to view some aditional info. I do
this by double-clicking on a field. And the modal popup form pops up. Good! I
open the Popup form using a Double-Click to run Docmd.Openform
"FormName",,,,, Forms!frm_case!subform1!ssubform1!.form.ChildsDetailsID.

In the popup form I have Private Sub Form_Open event with
Me.Recordset.FindFirst "ChildDetailsID = " Me.OpenArgs

But it find All the records. Any suggesstions?

TIA
johnb
 
M

Marshall Barton

johnb said:
I have a Access 2003 Form with a subform, which in turn has a subform. the
Sub-Subform is a datasheet view. I need to view some aditional info. I do
this by double-clicking on a field. And the modal popup form pops up. Good! I
open the Popup form using a Double-Click to run Docmd.Openform
"FormName",,,,, Forms!frm_case!subform1!ssubform1!.form.ChildsDetailsID.

In the popup form I have Private Sub Form_Open event with
Me.Recordset.FindFirst "ChildDetailsID = " Me.OpenArgs

But it find All the records.


FIndFirst is supposed to **navigate** to the first record
that matches so It can't possibly "find all the records".

Perhaps you want to filter the form's records to the
matching ID field?? If so, don't use OpenArgs/FindFirst,
instead use the WhereCondition argument:

Docmd.Openform "FormName", , , "ChildDetailsID = " &
Forms!frm_case!subform1!ssubform1.Form.ChildsDetailsID

Note that you are mixing your use of ! and .Form
For the sake of consistency, you should use either:

Forms!frm_case!subform1!ssubform1!ChildsDetailsID
or
Forms!frm_case!subform1.Form.ssubform1.Form.ChildsDetailsID

I prefer the ,Form syntax because it specifies precisely
what I want without making Access guess where to resolve the
name of the control.

Also note that if the double click event is in ssubform1,
then, you can use the shorter reference:
Me.ChildsDetailsID
instead of the full Forms!. . . reference.
 
D

Daryl S

Johnb -

You need the ampersand to tell Access that the Me.OpenArgs is part of the
Findfirst criteria.

Me.Recordset.FindFirst "[ChildDetailsID] = " & Me.OpenArgs

If ChildDetailsID is a string (rather than numeric), then you also need the
text delimeters:

Me.Recordset.FindFirst "[ChildDetailsID] = '" & Me.OpenArgs & "'"
 
J

John W. Vinson

Hi All
I have a Access 2003 Form with a subform, which in turn has a subform. the
Sub-Subform is a datasheet view. I need to view some aditional info. I do
this by double-clicking on a field. And the modal popup form pops up. Good! I
open the Popup form using a Double-Click to run Docmd.Openform
"FormName",,,,, Forms!frm_case!subform1!ssubform1!.form.ChildsDetailsID.

You have too many delimiters: try

Forms!frm_case!subform1!ssubform1.form.ChildsDetailsID

without the ! before .form.

If the dblclick code is in fact on ssubform1, you can do it more simply:

DoCmd.OpenForm "FormName", OpenArgs:=Me!ChildsDetailID

using the "named argument" syntax instead of laboriously counting commas, and
the Me! shortcut to refer to the current form.
 
R

Roger Carlson

You have multiple errors in your code. Here's a link to a couple of samples
that should help:
http://msdn.microsoft.com/en-us/library/aa160845(office.10).aspx


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L


Daryl S said:
Johnb -

You need the ampersand to tell Access that the Me.OpenArgs is part of the
Findfirst criteria.

Me.Recordset.FindFirst "[ChildDetailsID] = " & Me.OpenArgs

If ChildDetailsID is a string (rather than numeric), then you also need
the
text delimeters:

Me.Recordset.FindFirst "[ChildDetailsID] = '" & Me.OpenArgs & "'"

--
Daryl S


johnb said:
Hi All
I have a Access 2003 Form with a subform, which in turn has a subform.
the
Sub-Subform is a datasheet view. I need to view some aditional info. I
do
this by double-clicking on a field. And the modal popup form pops up.
Good! I
open the Popup form using a Double-Click to run Docmd.Openform
"FormName",,,,, Forms!frm_case!subform1!ssubform1!.form.ChildsDetailsID.

In the popup form I have Private Sub Form_Open event with
Me.Recordset.FindFirst "ChildDetailsID = " Me.OpenArgs

But it find All the records. Any suggesstions?

TIA
johnb
 
R

Roger Carlson

Sorry, I responded to the wrong post. I meant to respond the the original.


--
--Roger Carlson
MS Access MVP
www.rogersaccesslibrary.com
http://rogersaccessblog.blogspot.com/


Daryl S said:
Johnb -

You need the ampersand to tell Access that the Me.OpenArgs is part of the
Findfirst criteria.

Me.Recordset.FindFirst "[ChildDetailsID] = " & Me.OpenArgs

If ChildDetailsID is a string (rather than numeric), then you also need
the
text delimeters:

Me.Recordset.FindFirst "[ChildDetailsID] = '" & Me.OpenArgs & "'"

--
Daryl S


johnb said:
Hi All
I have a Access 2003 Form with a subform, which in turn has a subform.
the
Sub-Subform is a datasheet view. I need to view some aditional info. I
do
this by double-clicking on a field. And the modal popup form pops up.
Good! I
open the Popup form using a Double-Click to run Docmd.Openform
"FormName",,,,, Forms!frm_case!subform1!ssubform1!.form.ChildsDetailsID.

In the popup form I have Private Sub Form_Open event with
Me.Recordset.FindFirst "ChildDetailsID = " Me.OpenArgs

But it find All the records. Any suggesstions?

TIA
johnb
 

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