Another FindRecord problem

WindSailor

Registered User.
Local time
Yesterday, 18:15
Joined
Oct 29, 2003
Messages
239
I have Form1 that is built from Query1, Form2 is built off of Query1 also, but is used as a quick or small 'update' form that is called from Form1, you could say that Form2 is a pop-up form called from Form1.
While Form1 is loaded, I use Form2 to update or make changes on certain items. I would like to be able to close Form2, perform a requery on and maintain my position on Form1.

So on the 'OnClose' event of Form2, I tried:

Dim Ttemp As String

Forms![Form1].SetFocus

Ttemp = Forms![Form1]!FullN

DoCmd.FindRecord Ttemp

Forms![Form1].SetFocus

DoCmd.Requery


It errors out at:

DoCmd.FindRecord Ttemp

With "Run-time error '2046' - The command or action 'FindRecord' isn't available now".
If I hover my mouse over Ttemp, the correct value is listed in the intellisense.

Any ideas or other suggestions?

Thanks
 
still doing research. I found this which helps... and just may be exactly my case...

Requerying a form invalidates any bookmarks set on records in the form. However, clicking Refresh on the Records menu doesn't affect bookmarks.
Since Microsoft Access creates a unique bookmark for each record in a form's recordset when a form is opened, a form's bookmark will not work on another recordset, even when the two recordsets are based on the same table, query, or SQL statement. For example, suppose you open a form bound to the Customers table. If you then open the Customers table by using Visual Basic and use the ADO Seek or DAO Seek method to locate a specific record in the table, you can't set the form's Bookmark property to the current table record. To perform this kind of operation you can use the ADO Find method or DAO Find methods with the form's RecordsetClone property.

I will try this shortly or tomorrow.

I did try...

Me.RecordsetClone.FindFirst "FullN = '" + Ttemp + "'"
Forms![Form1].SetFocus
Forms![Form1].Refresh
Me.Bookmark = Me.RecordsetClone.Bookmark

still no go... this was still on the 'close' event of Form2.

To me I dont know if its right, but instictively I still want to code it on the 'close' event of Form2, save the value of FullN, do the refresh or requery and then return to that value on Form1. On the code that is immediately above the .Refresh just seems to refresh the form and not re-run the query which is what I want to do and then return to the last viewed record.
Just a thought, maybe save the current value of FullN, close Form1, reopen Form1 with criteria and presto chango... not what I want... as always... open to suggestions. :)
 

Users who are viewing this thread

Back
Top Bottom