bookmark problem

J

JohnE

I have a main form (usrfrmContracts) and in it there is a
subform (usrfrmContractNotes) that can have many notes to
the one contract entry. I also have a listbox
(lstContractNotes) on the main form that displays the
ClientCode, DateEntered, and EnteredBy fields, same as
what is in the subform. I would like to be able to have
the user click on the listbox line of the date they want
to see and have the subform move to it. Below is the
bookmark language that I did but keep getting the "Type
Mismatch" error. I've been staring at this for too long
and I am not seeing what is wrong. Can anyone assist?
******************
Private Sub lstContractNotes_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "Forms![usrfrmContracts]!Form
[usrfrmContractNotes]![ContractNotesID] = " & Str(Me!
[lstContractNotes])
Me.Bookmark = rs.Bookmark

End Sub
******************
Thanks to anyone who responds.
*** John
 
D

Dan Artuso

Hi,
First off, I beleive you'll want to get the recordset for your subform,
not the main form. Also, you'll have to have the ContractNotesID as
the bound column in your listbox (make it the first column as well).


Set rs = Me.usrfrmContractNotes.Form.Recordset.Clone
rs.FindFirst "[ContractNotesID] = " & Me.lstContractNotes)
Me.usrfrmContractNotes.Form.Bookmark = rs.Bookmark
 
J

JohnE

Dan, thanks, this worked. I went back to the listbox and
I did not have the ID as part of the qry. I guess it's
tough to see the forest for all the trees.
Thanks again.
*** John

-----Original Message-----
Hi,
First off, I beleive you'll want to get the recordset for your subform,
not the main form. Also, you'll have to have the ContractNotesID as
the bound column in your listbox (make it the first column as well).


Set rs = Me.usrfrmContractNotes.Form.Recordset.Clone
rs.FindFirst "[ContractNotesID] = " & Me.lstContractNotes)
Me.usrfrmContractNotes.Form.Bookmark = rs.Bookmark


--
HTH
Dan Artuso, Access MVP


I have a main form (usrfrmContracts) and in it there is a
subform (usrfrmContractNotes) that can have many notes to
the one contract entry. I also have a listbox
(lstContractNotes) on the main form that displays the
ClientCode, DateEntered, and EnteredBy fields, same as
what is in the subform. I would like to be able to have
the user click on the listbox line of the date they want
to see and have the subform move to it. Below is the
bookmark language that I did but keep getting the "Type
Mismatch" error. I've been staring at this for too long
and I am not seeing what is wrong. Can anyone assist?
******************
Private Sub lstContractNotes_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "Forms![usrfrmContracts]!Form
[usrfrmContractNotes]![ContractNotesID] = " & Str(Me!
[lstContractNotes])
Me.Bookmark = rs.Bookmark

End Sub
******************
Thanks to anyone who responds.
*** John


.
 

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