URL Formula to open a different form

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am sure this has been answered before but I can't find it. I would like to create a formula url that opens a form other than the main form in a table. Can anyone help?
Photo of coachDave

coachDave

  • 0 Points

Posted 6 years ago

  • 0
  • 1
Photo of hansen_33

hansen_33

  • 20 Points
Create a Formula URL field.
The formula below will redirect the user to the Edit Mode of Form # 12 in the current table.

URLRoot() & "db/" & Dbid() & "?a=er&key="&[Record ID#]&"&dfid=12"




CODE BREAKDOWN

[Record ID#] represents the current key field for the table and should be replaced with the key field of the table in your application.

dfid refers to the ID of the form to which you wish to redirect the user. To find the fid of your form, find your form on the table properties and look in the url. you should find part of the url where it says dfid=x take that number for your form and enter it into the formula.

To display the record, instead of going straight to edit mode, change the 'er' to 'dr' in this part of the formula:
Dbid() & "?a=er&key="&[
Photo of coachDave

coachDave

  • 0 Points
Thanks very much for the quick response. As I am not very good at coding let me be a little more specific. I want to add this formula url field to a parent table and have it open up a form to add a record in a child table. Would your example change?
Photo of coachDave

coachDave

  • 0 Points
Thanks very much for the quick response. As I am not very good at coding let me be a little more specific. I want to add this formula url field to a parent table and have it open up a form to add a record in a child table. Would your example change?
Photo of hansen_33

hansen_33

  • 20 Points
That is much different. If you are trying to edit the 'Add Child Record' button, there is a simple modification you could make. If you want to create a standalone button, you could use the following: URLRoot() & "db/" & "xxxxxxx" & "?a=nwr&"&"dfid=yy"  where the xxxxxxx is the table dbid for your other table and the yy is the form id. the a=nwr is the action telling the button to go to the add a new record screen. However, there is nothing here telling the button to relate the record to the record you are clicking from. (To find the dbid of the child table, just click the add new child record button and in the url you should see some letters and numbers after the /db/ but before the ?a=nwr. )

To modify your add child record button you might edit the buttons formula to end with something like [Record ID#] & "&dfid=yy" & "&z=" & Rurl()
just take everything after the [Record ID#] out and paste:  & "&dfid=yy" & "&z=" & Rurl()   then change the yy to your form id on the child table.

Hope that helps! =]
Photo of Evin

Evin

  • 0 Points
Is there a way to fill in fields on edit record (er) command. So that when the link is clicked and the form is opened some of the fields are populated?