Select to view content in your preferred language

how to call a related table form from a button on an edit form

2744
3
05-01-2013 09:48 AM
LauraBlackburn
New Contributor III
Does anyone know how to reference a related table's form page?  I am trying to record tree heights and my trees are already spatially referenced, I just need the user to collect growth measurements which are part of a related table.  I tried calling this code on the "onClick" event of the button's control properties, but it doesn't work.  Can anyone out there help?

Sub RecordHeights()
  Dim pg
  Set pg = Application.Map.Layers.Item("Tree").Forms.Item("EDITFORM").Pages.Item("pgInventory").Activate
  Set pg = Nothing
End Sub
Tags (3)
0 Kudos
3 Replies
GarethWalters
Occasional Contributor III
Hi Laura,

The current implementation of ArcPad doesn't allow you to edit the related table like this, unless you want to do a severe (non UI) work around.

The simplest approach is to always activate the related table form (TABLEFORM) and then you can run your script while on the page. The related form is nested inside the layers form, like those russian dolls, so you must open one to get to the other. If you go down this approach you can use the ThisEvent.Object to get the reference of the TableForm and you can traverse the pages from there.

e.g. When you open the related table form:
Use the Page OnSetActive event > myRelForm = ThisEvent.Object.Parent
Then you can traverse the pages - ThisEvent.Object.Parent.Pages(...)

I hope this doesn''t muddy the waters too much.

Let me know how you go.

Cheers,

Gareth

The non UI approach is to use the layer DataSource object and update the underlying related table using SQL. This method has to update the AXF_ columns in the dataset as well.
0 Kudos
LauraBlackburn
New Contributor III
Hey Gareth,

Thanks so much for checking in on me.  I am making very slow progress.  Can you clue me in a bit more on where to place my code and what it should look like?  I tried putting "Call RecordHeights" under the on click event of a button on my editform with the Subroutine in my vbs file.  I also tried putting code right into the on click event....I am not sure which is the way to go.

Also, not exactly sure of the syntax.

Here's my code, but I get a type mismatch [Line 1: Column 1] when it's fired...so I am sure something is wrong here.
Sub RecordHeights()
  Dim myRelForm
  myRelForm = ThisEvent.Object.Parent
  ThisEvent.Object.Parent.Pages.Item("pgInventory").Activate
End Sub
0 Kudos
MatthewSkewes
New Contributor
I'm also looking for a solution to this issue, I would like to add a couple of buttons that open related table edit forms from the main edit form page. Will keep an eye on this thread.
0 Kudos