Bookmark Issue

G

GLT

Hi,

I had this working perfectly a while ago, and I've made some change and now
its not working. After my mainform went to the same record as my unbound
subform, my subform would stay on its selected record. Now it goes way back
to the 1st record, very annoying for a list thats 300 records long.

Can anyone advise how to fix this?

Cheers,

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
Set rs1 = Me.Parent.RecordsetClone


rs.FindFirst "[RecID] = '" & Me.RecID & "'"
rs1.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent.Bookmark = rs1.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery
End If
Set rs = Nothing
Set rs1 = Nothing

End Sub
 
G

GLT

I tried commenting out the following:
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery

Its still doing it .... grrrrr

Daryl S said:
GLT -

I suspect it is the Me.Requery after the Me.Bookmark = rs.Bookmark.
--
Daryl S


GLT said:
Hi,

I had this working perfectly a while ago, and I've made some change and now
its not working. After my mainform went to the same record as my unbound
subform, my subform would stay on its selected record. Now it goes way back
to the 1st record, very annoying for a list thats 300 records long.

Can anyone advise how to fix this?

Cheers,

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
Set rs1 = Me.Parent.RecordsetClone


rs.FindFirst "[RecID] = '" & Me.RecID & "'"
rs1.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent.Bookmark = rs1.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery
End If
Set rs = Nothing
Set rs1 = Nothing

End Sub
 
D

Daryl S

GLT -

I think you still want the bookmark statement in there:

Me.Bookmark = rs.Bookmark


--
Daryl S


GLT said:
I tried commenting out the following:
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery

Its still doing it .... grrrrr

Daryl S said:
GLT -

I suspect it is the Me.Requery after the Me.Bookmark = rs.Bookmark.
--
Daryl S


GLT said:
Hi,

I had this working perfectly a while ago, and I've made some change and now
its not working. After my mainform went to the same record as my unbound
subform, my subform would stay on its selected record. Now it goes way back
to the 1st record, very annoying for a list thats 300 records long.

Can anyone advise how to fix this?

Cheers,

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
Set rs1 = Me.Parent.RecordsetClone


rs.FindFirst "[RecID] = '" & Me.RecID & "'"
rs1.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent.Bookmark = rs1.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery
End If
Set rs = Nothing
Set rs1 = Nothing

End Sub
 
G

GLT

Hi Daryl, Thanks for your reply - I tried uncommenting

Me.Bookmark = rs.Bookmark

And it is till doing it. This is very frustrating...


Daryl S said:
GLT -

I think you still want the bookmark statement in there:

Me.Bookmark = rs.Bookmark


--
Daryl S


GLT said:
I tried commenting out the following:
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery

Its still doing it .... grrrrr

Daryl S said:
GLT -

I suspect it is the Me.Requery after the Me.Bookmark = rs.Bookmark.
--
Daryl S


:

Hi,

I had this working perfectly a while ago, and I've made some change and now
its not working. After my mainform went to the same record as my unbound
subform, my subform would stay on its selected record. Now it goes way back
to the 1st record, very annoying for a list thats 300 records long.

Can anyone advise how to fix this?

Cheers,

Sub Form_Click()
Dim rs As DAO.Recordset
If Me.Parent.Dirty Then
Me.Parent.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
Set rs1 = Me.Parent.RecordsetClone


rs.FindFirst "[RecID] = '" & Me.RecID & "'"
rs1.FindFirst "[RecID] = '" & Me.RecID & "'"

If Not rs.NoMatch Then
Me.Parent.Bookmark = rs1.Bookmark 'reposition the form
Me.Parent![ServerList].Requery
Me.Bookmark = rs.Bookmark
Me.Requery
End If
Set rs = Nothing
Set rs1 = Nothing

End Sub
 
D

Daryl S

GLT -

Have you stepped through the code to see what is happening? You can set a
breakpoint on the first executable statement in the code, and then see what
statements it is executing. If the rs1.findfirst working (e.g. is a match
found)?
 
G

GLT

Hi Daryl,

Just wanted to let you know that the issue wound up being a query problem.

I added a combox box to my form, and refrenced the value of the combo box to
the same underlying query that the form was working off (kind of circular
refrence thing). because of this, the bookmarks stopped working.

Cheers,
GT.
 
D

Daryl S

Great - thanks for the update!

--
Daryl S


GLT said:
Hi Daryl,

Just wanted to let you know that the issue wound up being a query problem.

I added a combox box to my form, and refrenced the value of the combo box to
the same underlying query that the form was working off (kind of circular
refrence thing). because of this, the bookmarks stopped working.

Cheers,
GT.
 

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