Listbox afterupdate

R

Ross

Hi Guys
Have a PopUp form with a listbox which with afterupdate trigger displays the
requested record on that popUp form. Is there anyway to display this same
record on the main form as well without locking the record on the main form
through a filter?
Cheers Ross
 
K

Ken Sheridan

Ross:

In the AfterUpdate event procedure of the list box on the popup form return
a reference to the main form and then to its RecordsetClone. You can then
find the matching record and synchronize the mains form's Bookmark with that
of its RecordsetClone, e.g.

Dim frm As Form
Dim rst As Object

Set frm = Forms!YourMainForm
Set rst = frm.Recordset.Clone

rst.FindFirst "MyID = " & YourListBox
frm.Bookmark = rst.Bookmark

Ken Sheridan
Stafford, England
 
R

Ross

You Star Ken
Works a treat
Cheers Ross

Ken Sheridan said:
Ross:

In the AfterUpdate event procedure of the list box on the popup form return
a reference to the main form and then to its RecordsetClone. You can then
find the matching record and synchronize the mains form's Bookmark with that
of its RecordsetClone, e.g.

Dim frm As Form
Dim rst As Object

Set frm = Forms!YourMainForm
Set rst = frm.Recordset.Clone

rst.FindFirst "MyID = " & YourListBox
frm.Bookmark = rst.Bookmark

Ken Sheridan
Stafford, England
 
Z

zweet18

I did all of that but I have this error
"MS Office Access cant find the form 'frmTimeCards' referred to in a macro
expression or VBcode"

the formname is correct I don't why there's an error
Please help thanks much

This my coding

Private Sub cmdFind_Click()

Dim rst As DAO.Recordset

Set rst = Form!frmTimeCards.RecordsetClone

rst.FindFirst "TimeCardID = " & "'" & lstFind & "'"

Form!frmTimeCards.Bookmark = rst.Bookmark

DoCmd.Close acForm, "frmFindTimeCards"

End Sub
 
Top