Select Records on Subform From Listbox

  • Thread starter Thread starter Steven Buick
  • Start date Start date
S

Steven Buick

Is there any way to select records in a subform from a
listbox in the main form. What I have is a POS invoice
which populates a listbox with the items entered into the
subform. What I want to do is when the user clicks an item
in the listbox, the corresponding record is highlighted in
the subform so that the user can perform some action on
it, eg return it to stock.

Thanks!

Steve
 
Usually a unbound list box does exactly that, if your
subform is linked to the parent form correctly. In that
case if the listbox's bound column is a field that belongs
in the parent form then choosing that field should refresh
the sub form.
If u use the list box wizard to create an unbound listbox
it creates the codes to find and position the record
selector.
 
I've had similar problems. I think what I did was if there
was a matching record then trasfer focus to the subform
and then highlight that record...
-----Original Message-----
I know it will do it on the main form and I've tried using
similar code to select a record in the subform but it
doesn't work. Using that code the only reference I can
make to a recordset is from the main form ie I can do
Me.Recordset but can't do [Forms]![Invoice]![Invoice
Details subform].recordset.
-----Original Message-----
Usually a unbound list box does exactly that, if your
subform is linked to the parent form correctly. In that
case if the listbox's bound column is a field that belongs
in the parent form then choosing that field should refresh
the sub form.
If u use the list box wizard to create an unbound listbox
it creates the codes to find and position the record
selector.
.
.
 
Just sussed out how to do it! On the afterupdate event of
the list box I did the following code:-

Private Sub CustomersReceipt_AfterUpdate()
Dim recToFind As Long
recToFind = Me.CustomersReceipt.ListIndex + 1
Me.Invoice_Details_subform.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acGoTo, recToFind
End Sub
-----Original Message-----
I've had similar problems. I think what I did was if there
was a matching record then trasfer focus to the subform
and then highlight that record...
-----Original Message-----
I know it will do it on the main form and I've tried using
similar code to select a record in the subform but it
doesn't work. Using that code the only reference I can
make to a recordset is from the main form ie I can do
Me.Recordset but can't do [Forms]![Invoice]![Invoice
Details subform].recordset.
-----Original Message-----
Usually a unbound list box does exactly that, if your
subform is linked to the parent form correctly. In that
case if the listbox's bound column is a field that belongs
in the parent form then choosing that field should refresh
the sub form.
If u use the list box wizard to create an unbound listbox
it creates the codes to find and position the record
selector.
-----Original Message-----
Is there any way to select records in a subform from a
listbox in the main form. What I have is a POS invoice
which populates a listbox with the items entered into the
subform. What I want to do is when the user clicks an
item
in the listbox, the corresponding record is highlighted
in
the subform so that the user can perform some action on
it, eg return it to stock.

Thanks!

Steve
.

.
.
.
 
Back
Top