Display record on Main Form from subform record selection

B

bjwheeler

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
 
D

Dirk Goldgar

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


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.
 
B

bjwheeler

Hi there,
I have amainProfileForm(called Profile) and a subformwhich has
Associated Profiles (called Associates) listed in a continuousform.
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 theMainProfileForm.
Each associaterecordis 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.

Ben

I'm not quite sure I have the field names correct.  If [Associates Profile
ID] is the name of the field on thesubform, and your goal is to find themain-form recordwhere [Profile ID] equals that [Associates Profile ID],
then code along these lines (running behind the button on yoursubform)
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.

Thanks this worked a treat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top