Listbox afterupdate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 
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
 
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
 
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
 

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

Back
Top