listbox selection

J

JohnE

I have a main form with a listbox on it that displays the date of entries.
Also on the mainform is a subform that is continuous that the entries are
made. There will be at least one entry per day. The listbox is to select
the date and have the subform go to that date's entry. I have gotten that to
work using the master/child method. But, what is occurring is the subform
does not display anything until a date is selected.

What is needed is to have all the info displayed in the subform when the
form opens and go to the record when the date in the listbox is selected.
How can this be done?

Thanks for the help.
.... John
 
M

Marshall Barton

JohnE said:
I have a main form with a listbox on it that displays the date of entries.
Also on the mainform is a subform that is continuous that the entries are
made. There will be at least one entry per day. The listbox is to select
the date and have the subform go to that date's entry. I have gotten that to
work using the master/child method. But, what is occurring is the subform
does not display anything until a date is selected.

What is needed is to have all the info displayed in the subform when the
form opens and go to the record when the date in the listbox is selected.


The Link Master/Child properties filter the subform records.
It sounds like you only want to navigate to a matching
record. If that's the case, then clear the Link
master/Child properties and use code like this in the list
box's AfterUpdate event procedure:

With Me.subformcontrol.Form.RecordsetClone
.FindFirst "datefield=" & Format(Me.listbox,
"\#yyyy-m-d\#")
If Not .NoMatch Then
Me.subformcontrol.Form.Bookmark = .Bookmark
End If
End With
 

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