Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Example LotusScript: Creating a new row in a repeating panel

Last updated: 4 Nov 2003

In order to add a new line to a repeating panel the focus (cursor) must be in the repeating panel. This means that your macro will either have to tab into the panel, or you need to attach it to a button which is in the repeating panel such that it appears on every line of the panel.

A neater approach is to use a script, such as this one submitted by Paul Bent. Paul writes:

"This code is attached to a "New Line" button on an Orders form. The ProductID field is first in the rp's tab order. If the field in the first row is empty there are no existing order lines. In this case it just has to set focus in the first row to start a new record. If there are rows, it sets focus in the first one then starts a new record."

Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
        On Error Goto ErrTrap
        If CurrentView.rpOrdItems.cboProductID.Text = "" Then
        End If
        Goto  ExitSub
        Msgbox "Error " & Str$(Err) & " - message: " & Error$, 16, "System Error"
        Resume ExitSub
End Sub

If you want to add the new line at the top of the repeating panel, then check out "Inserting a new blank record at the top of a repeating panel" in the <A HREF="examples.htm">Example Databases</A> section of this web site.

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.