List Box / Form / Subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a listbox and a subform both on a form (frmA). I would like to go to the correct record on the subform based on the selection made in the listbox

Any help would be greatly appreciated
 
Gregory said:
Hi,

I have a listbox and a subform both on a form (frmA). I would like to go to
the correct record on the subform based on the selection made in the listbox.
Any help would be greatly appreciated.

Make the ListBox the MasterLink property setting for the Subform control. Make
the ChildLink property setting be the appropriate field in the Subform.
 
Hi,
You don't say what the common field is between the listbox and your subform
but I'll assume there is one. This code would go in the after update event of the
listbox:

Me.Form.RecordsetClone.FindFirst "yourField = " & Me.yourListbox
Me.Form.Bookmark = Me.Form.RecordsetClone.Bookmark

Usually the common field is some sort of ID field. If it's text, you have to delimit the
criteria with single quotes:
yourField = '" & Me.yourListbox & "'"

Now, usually in a form/subform setup, navigating in your mainform causes the subform
to display the 'details' for the current record on the main form, so your request is a bit unusual.
 
Hi Dan

Sorry for being such a pain....

I am getting Run-Time Error '7951'
You entered an expression that has an invalid reference to the RecordsetClone Property

Any ideas

Again thanks for your hel

Gre


----- Dan Artuso wrote: ----

Hi
You don't say what the common field is between the listbox and your subfor
but I'll assume there is one. This code would go in the after update event of th
listbox

Me.Form.RecordsetClone.FindFirst "yourField = " & Me.yourListbo
Me.Form.Bookmark = Me.Form.RecordsetClone.Bookmar

Usually the common field is some sort of ID field. If it's text, you have to delimit th
criteria with single quotes
yourField = '" & Me.yourListbox & "'

Now, usually in a form/subform setup, navigating in your mainform causes the subfor
to display the 'details' for the current record on the main form, so your request is a bit unusual

-
HT
Dan Artuso, Access MV
 
Ok I figured it out....I am truly a vegetable and shouldn't be allowed near a computer

Thanks again Da

----- Gregory wrote: ----

Hi Dan

Sorry for being such a pain....

I am getting Run-Time Error '7951'
You entered an expression that has an invalid reference to the RecordsetClone Property

Any ideas

Again thanks for your hel

Gre


----- Dan Artuso wrote: ----

Hi
You don't say what the common field is between the listbox and your subfor
but I'll assume there is one. This code would go in the after update event of th
listbox

Me.Form.RecordsetClone.FindFirst "yourField = " & Me.yourListbo
Me.Form.Bookmark = Me.Form.RecordsetClone.Bookmar

Usually the common field is some sort of ID field. If it's text, you have to delimit th
criteria with single quotes
yourField = '" & Me.yourListbox & "'

Now, usually in a form/subform setup, navigating in your mainform causes the subfor
to display the 'details' for the current record on the main form, so your request is a bit unusual

-
HT
Dan Artuso, Access MV
 
Back
Top