Fragment Builder

Buttons2 Buttons

Introduction

Fragments are pieces of code that occur regularly in programs but which can't be encapsulated in procedures. The image shows a typical example of a fragment (Open Jet Database). It consists of a series of lines you use regularly in your code, but which you would normally not encapsulate in a procedure. Which fragments folders are visible in the tree depends on:

  1. selected node in the tree: all items are shown from the selected node + all it's child nodes
  2. what references the project has. For example if the project has a reference to DAO, it shows the fragments for DAO and not for ADO and visa versa.

Inserting a fragment

Start this dialog from Toolbar or using Alt-CN ( Code-vb - Fragme nt)

Coding using fragment builder consists of selecting the appropriate fragment and moving through the open parameter positions using tab. At each positions a pop-up lets you select an appropriate action: insert an existing or new variable or expression. A selected variable will automatically replace all parameter positions with the same specification (see below). [Insert] adds the fragment to the current position in the code module. The cursor is automatically moved to the position in the fragment marked with <cursor>.

A selected variable will automatically replace all parameter positions with the same specification

Shortcuts

If you want a node to appear at multiple nodes in the tree you can use shortcuts. This makes it easier to find the node you require. For example looping throughmultiple files fragment you might look for either under the Files and Folders node and under Loops node.

To create a shortcut:

  1. Select the item you want to have a shortcut from
  2. Right-click > Copy for Shortcut
  3. Select the folder you want to copy the shortcut to
  4. Right-click > Paste shortcut

Note: you can also use Explorer to create shortcuts.

Controls:

New

Create a new fragment.

Edit

Edit selected fragment.

Delete

Delete selected fragment

Insert

Inserts the fragment to the current position in the code module. The cursor is automatically moved to the position in the fragment marked with <cursor>. Uses defaults on not specified parameters.

Cancel

Closes the builder without adding the fragment

Help

Starts this Help topic

Builders and tools included in Code VBA