Have you tried using the Go to Related Record script step?
Set this up in either a script or just as the Script Step assigned to your button, either way, once you have selected the Script Step you need to set the 'Get related records from:' option to be the table occurrence that your portal is based on and then the 'Show records using layout:' can be left as '<Current Layout>' based on your question, but you need to make sure the Table Occurrence your layout uses is based on the same underline Table as the Table Occurrence your portal is based on.
I hope this helps
Here is a nice demo (Portal Sidebar Navigation System) which seems to fit your needs exactly. Sometimes it is nice to have a demo file to which to work:
Thanks for your reply:
"Have you tried using the Go to Related Record script step?" yes but it dosn't work yet?
Could it be that the main layout form and the portal are both from the same table? basically I have a table with all my contacts in but as I can have a few contacts for the same company I am using the portal to list related contacts. I have set a relationship from the contact database back to itself using the company names as the relationship.
This portal lists the different contacts ok and I am using their name and surname as 2 fields in the portal.
I have set a button trigger in the portal to go to related record, but when clicked it dosn't update the current layout record.
La retta, has posted an example of what I want but I have to now figure out how it works with my database.
This is perfect for my needs, it is exactly what I want to do. Now all I have to do is work out how to make it work on my database. I notice that this example uses a unrelated table called system and it has no records in it?
I will start to play with this to find out how it is done.
Both my layout screen record and portal are both in the same table, and I have set a relationship from the contact table back onto its self with the company name as the related field. I am not sure if this is causing my issue?
I thought the demo might make it easier but here is a basic concept to step through (from beginning to end):
Duplicate your Contacts table. Name it Contacts_Same_Company. Join as:
Contacts::CompanyName = Contacts_Same_Company::CompanyName
Contacts::ContactID <> Contacts_Same_Company::ContactID
... this 'not equal' line is so that the person you are viewing in the main record doesn't appear again in the portal while on that particular record.
Place a portal based upon Contacts_Same_Company on the Contacts layout. Turn off entry in Browse mode to the FirstName and LastName fields (using field behavior). Be sure that the fields you place inside this portal are based upon the Contacts_Same_Company table occurrence.
As Orlando indicated, you will then attach a button to the First Name and Last Name fields in the portal and it will be:
Go To Related Record [ Get Related Record from "Contacts_Same_Company" ; Using Layout "Current Layout" ]
Do NOT check below where it says "Show Only Related Records." If you do, you will lose your current found set of Contacts and it is NOT necessary to take advantage of the Go To Related script step.
Can you just confirm: I copy the contacts table but the new copy table has no records in it? it is just used as a link.
"I copy the contacts table but the new copy table has no records in it? "
Nope, Fluffy. You make a copy (using the ++) of your Contacts table in the graph (you don't make another table - only another 'occurrence' of it). All copies of tables in the graph are known as Table Occurrences (TOs). It is similar to a shadow table, meaning it *IS* the same table as Contacts but you name it differently and join it to itself.
After you do this, you can go to your Tables tab and find your Contacts table. To the right, it will now show two occurrences of it; one named Contacts and one named Contacts_Same_Company (the name you gave the duplicated occurrence in the graph).
Sorry I know I might sound a bit silly, I am learning as I go (but I am a quick learner!). The problem is I work long hours in my business and I develop my database at night on my laptop when I am tired, so it is not always clear to me when I do things first time!
After I posted the message about the copy table I went to bed, and whilst lying there I thought I was being silly and that you meant copy the table in the graph for a relationship, I tried it first thing this morning and it works brilliantly!
And I noticed your reply first thing this morning, thank you. With reference to the link you gave me for the sample database, it was a great reference and I said I had to work out how to use meaning that evening when I got home but as you have followed it up with the post on how to do it I am now sorted.
Thank you very much for your help.