Problem with findfirst for subform (1 Viewer)

skunk711

Registered User.
Local time
Today, 16:52
Joined
Jun 19, 2002
Messages
24
I'm having problems with a subform that has a list box and three fields under the list box.

All i want to do is have the fields under the listbox display with the record clicked in the list box. I've done this heaps of times before, but can't quite work out why this one is any different.

I have tried heaps of different ways of doing this, and this is my latest attempt.


Dim rst As Object
Dim dbs As Object

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("invites", dbOpenDynaset)
rst.FindFirst "[InviteeID] = " & [Forms]![Events]![eventsSubformINV]![List4]
If Not rst.EOF Then Me.Bookmark = rst.Bookmark


this comes up with an error sayng 'Not a valid bookmark' for the last line.


Another thing i tried was

Dim rs As Object
Set rs = Forms![Events]![eventsSubformINV].Form.RecordsetClone
rs.FindFirst "[InviteeID] = " & Me.List4
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

which just doesnt even find the record at all, even tho it is there when i run this when the form is by itself instead of a subform.

I know its something to do with the record set changing when you reference it from a subform, but it got me stuffed.

Any help would be appreciated.

Ben
 

DALeffler

Registered Perpetrator
Local time
Today, 09:52
Joined
Dec 5, 2000
Messages
263
I've had problems when using boolean logic in if statements before. I can't remember the specifics but I DO remember that to fix it, I coded like this:

If rs.EOF = False Then Me.Bookmark = rs.Bookmark

HTH,

Doug.
 

skunk711

Registered User.
Local time
Today, 16:52
Joined
Jun 19, 2002
Messages
24
Thanks for the reply, however, my problem isnt with the...

If Not rst.EOF Then Me.Bookmark = rst.Bookmark

line of code.
My problem is that the recordset that i am createing has records in it ( i found this out by using a msgbox to output the rows) but when i try and when i do findFirst on the recordset the noMatch property is set to False.

This means its found the record, and therefore moves to that record in the recordset, but when i try to use that bookmark it says its invalid. (when i use msgbox to output the bookmark, all i get is '?'.

Any ideas?
 

Users who are viewing this thread

Top Bottom