List Box / Form / Subform

G

Gregory

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
 
R

Rick Brandt

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.
 
D

Dan Artuso

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.
 
G

Gregory

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
 
G

Gregory

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
 

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