Display record on Main Form from subform record selection

Display record on Main Form from subform record selection

Post by bjwheele » Thu, 18 Sep 2008 11:35:20


Hi there,

I have a main Profile Form (called Profile) and a sub form which has
Associated Profiles (called Associates) listed in a continuous form.
This is used for Family Members etc

What I want to happen is when a user clicks on a button called "Open
Profile" located next to each associated profile in the Associates sub
form. it opens that profile onto the Main Profile Form.

Each associate record is stored in the Associates table by Associates
Profile ID, this is also their Profile ID (in the Profile Table).

Now im sure I have not set this up correctly, however its working they
way i want it to at the moment....

Any help would be appreciated.

thanks

Ben
 
 
 

Display record on Main Form from subform record selection

Post by Dirk Goldg » Thu, 18 Sep 2008 12:26:05


I'm not quite sure I have the field names correct. If [Associates Profile
ID] is the name of the field on the subform, and your goal is to find the
main-form record where [Profile ID] equals that [Associates Profile ID],
then code along these lines (running behind the button on your subform)
ought to be close to what you want:

With Me.Parent.RecordsetClone
.FindFirst "[Profile ID] = " & Me![Associates Profile ID]
If Not .NoMatch Then
Me.Parent.Bookmark = .Bookmark
End If
End With

That assumes that these Profile ID fields are numeric. If they're text,
quotes must be embedded in the FindFirst criterion.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
 
 

Display record on Main Form from subform record selection

Post by bjwheele » Fri, 19 Sep 2008 09:22:01

On Sep 17, 2:26爌m, "Dirk Goldgar"




Thanks this worked a treat