Requery form and goto specific record based on record from different form (1 Viewer)

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
Okay, Have looked all over and can't seem to find the soultion, although some have come close but just not doin it.

I have a form (Main) that has 2 forms on it (A and B). Both A and B are linked to Main and have same recordset, but are not linked to eacth other. Form A is a single form and Form B is a continous form with the same recordset as Form A.

When I double click on a record in form B, I would like to requery Form A and goto the same record from which I chose in form B.

Desparatley Needing help here PLEASE!
 

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
See if this link is helpful. If not then post your db and we'll get it working for you.
 

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
Unless I'm missing something, this would work if I didn't have any crteria. But as I see it, my criteria is the record from form B. So I think I may have to do it with recordset cloning but not sure. And not sure how to do it.
 

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
Can you post your zipped up db for us to work with? It would be a lot easier to just do it that try and explain it in this forum. Remove any sensitive data of course.
 

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
I THOUGHT SOLUTION WAS FOUND! I thought I happened on to it.

Set Forms.parentform.subform1.Form.Recordset = Forms.parentform.subform2.Form.Recordset
Forms!parentform!subform2.requery

'subform1 is name of the form that contains the record you are selecting'
'subform2 is name of the form that will goto the record you selected in subform1'
'parentform is the name of the form containing subform1 and subform2'

I use it on a double click event.
 
Last edited:

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
In post #1 you said both SubForms had the same RecordSet. I don't see how setting them the same again will achieve anything. The word "Set" at the beginning serves no purpose and can be removed since you can not "Set" a form Property. You could also write:
Set Forms.parentform.subform1.Form.Recordset = Forms.parentform.subform2.Form.Recordset
...as...
ME.PARENT.subform1.Form.Recordset = ME.PARENT.subform2.Form.Recordset
...and assuming you are executing from SubForm2, you could write:
Me.Parent.subform1.Form.Recordset = Me.Recordset

Since you are saying you have a solution, I'll leave it at that. Congratulations.
 

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
Okay RuralGuy as per your request here is a portion of my db. Please help.
 

Attachments

  • Test.zip
    234.1 KB · Views: 119

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
There are several ways to do what you are asking. I just used one of them. You will notice I created some queries and removed a field from the Wages table.
 

Attachments

  • Test1.zip
    106.6 KB · Views: 112

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
Hmm...I've been doing other things and just remembered you wanted it on a DoubleClick. It currently changes just by selecting the record.
 

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
So, you said there were several ways to do what I'm looking for. Is there a way to do it without me having to go through and several queries as I will eventually have several diff forms set up the same way as what I'm looking to do.
 

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
I created the queries because you should *always* base your forms on queries rather than tables. It is manditory if you upgrade the backend to SQL Server. Queries take up little or no room. It is just a string of text so there is no penalty and they are way more powerful than a table.
 

Ray Spackman

Registered User.
Local time
Today, 06:55
Joined
Feb 28, 2008
Messages
52
Although this db will be a standalone, I do totally understand the importance of the information you have provided and find that I have drifted away form the basics. As such, I will head your advice and return to the basics. Thank You.
 

RuralGuy

AWF VIP
Local time
Today, 07:55
Joined
Jul 2, 2005
Messages
13,825
When I get my hands on a new db I just naturally start doing some cleanup. Old habits stay with you. Glad I could help. Did you download my db yet because the view count still shows 0 for me?
 

Users who are viewing this thread

Top Bottom