| Chat with a LIVE Microsoft
Access Expert! |
||||
|
||||
|
#1
|
||||
|
||||
|
bookmarking problem with recordsetclone
I have been trouble with a function that i coded to requery a subform and keeping the same record position.
My function is as follows: Code:
Public Function Search_AND_Requery(search As String, frm As subform, nPK As Integer)
frm.Requery
With frm.Form.RecordsetClone
.FindFirst search & " = " & nPK
If Not .NoMatch Then
frm.Form.bookmark = frm.Form.RecordsetClone.bookmark
End If
End With
End Function
If i hit debug and then just resume the code it works. Also, something interesting i figured out is that if i put just a blank messagebox before setting the bookmark then everything works out. Any ideas or help would be lovely! Thanks |
| Sponsored Links |
|
#2
|
||||
|
||||
|
Your code actually creates two clones. One is created at your With block.
Your problem line does not reference the same clone against which you've run your find operation. Your problem line creates a whole new clone. Try... Code:
With frm.Form.RecordsetClone .FindFirst search & " = " & nPK If Not .NoMatch Then frm.Form.bookmark = .bookmark End With Code:
With frm.Form.Recordset .FindFirst search & " = " & nPK If .NoMatch Then MsgBox "Not Found" End With |
|
#3
|
||||
|
||||
|
Hello.
Firstly, I would like to thank you very much for your aide and advice. I notice now that there are two recordsetclones and was completely unaware of that. After editing the code to match your first example, the problem still arose and instead of highlighting the entire line it just highlighted beginning with frm.Form.bookmark and to the end. I'm assuming it has to do with my frm variable because it is rather... ambiguous, in a way. Then, I went to try the second example. Now, the way that I have the form set up. There are some text boxes and whatnot and then a continuous subform with a bunch of entries within it. What I was setting up was a way for the user to just click on of these continuous subform entries and it would automatically select that entry to it's parent form. The problem with the second example is that the record is not selected, meaning the record indicator along the left hand side is not pointing towards that record... but the record is highlighted without actually being selected. Quite annoying. In conclusion, I have decided to change a few things and do some combo boxes instead of the continuous subform as it will be much easier and take less work and I won't have to worry about recordsets at all! Thanks again! |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| conversion problem | marc01 | General | 1 | 01-01-2007 03:58 AM |
| Saving Problem | mohammadagul | Forms | 2 | 04-25-2004 10:01 AM |
| Problem with Saveing Record | mohammadagul | Modules & VBA | 3 | 04-25-2004 09:58 AM |
| (Simple) problem with RecordsetClone. | RHT | General | 2 | 03-26-2004 02:46 PM |
| Math Problem.. | mission2java_78 | General | 3 | 08-28-2002 11:24 AM |