Coding Help Please...

TheStriker

Registered User.
Local time
Today, 23:48
Joined
Jan 5, 2004
Messages
17
Hello,

I have a main form and a subform with a list box. I want to be able to update the fields on the subform via the selection made in the listbox. I know the wizard can do this for a listbox if the fields are on the main form. I was wondering if anyone had code or can modify this code to update the fields in my subform. Here is the code created by the wizard:

Private Sub List7_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[nCommentID] = " & Str(Nz([List7], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Any help would be most appreciated. Thanks

Striker
 
Striker,

I'm not quite understanding what you mean here. Do you want
to requery the subform, so that it shows detail records based
on the selected listbox value?

If so, base the subform on a query. The query references the
listbox in the appropriate field's criteria.

Then using the double-click, or AfterUpdate event of the
listbox requery the subform.

Wayne
 
Hello WayneRyan,

You were the one who helped me with this on a previous post.
ListBox Not Updating on Subform

Your solution worked for a while until I noticed that clicking on a selection would duplicate that selected record in the underlying table. I've then tried to make the subform unbound and when I click on a selection in the listbox, I got a message saying "You cannot assign a value to this object. The object is read-only and cannot be set."

I'm thinking since the subform was bound to a table and when a selection was made, the values would re-insert themselves into the table. So I think at this point the best way to go would be to somehow create a Recordset that will "reach out" and alter the values on the subform or go the unbound route. I am not experienced at either...any suggestions.

Thanks
 
think i got
i placed me.requery in a event procedure (After Update)
of the combo box on the main form that selects the "lesson" (fld_lesson_id)

thanks for yall help
 

Users who are viewing this thread

Back
Top Bottom