FAQ
Vanliga frågor för självhjälp.
Ta en snabb titt på vanliga frågor (och svar) i standardlistan. Om du inte hittar det du letar efter, börja med att välja din Ability Office version och sedan begränsa den genom att ange söktext och/eller kategori.
Kunskapsbasartikel 96
How to use macro buttons to link Database formsHow to link two Database forms together using macros and macro buttons.
Typical scenario is that you're browsing in database form view and you want a button to display a record from another (usually related) table:
-
Switch the Form to Design Mode using View/Design
-
Select Insert/Macro Button and draw out the new button
-
Right-click and select Properties
-
Give the button some meaningful display text
-
Select the Macros tab
-
Select the "click" event (you don't have to but this is the normal way to use a button)
-
Select New Macro and give it a name
-
Save the form
-
In Database Manager, right-click over the new macro and select Edit
-
Enter the following code (adjust to your own form / field names)
Sub OpenRelatedForm ()
id = ActiveDataObject.Fields("LinkFld1").Value
Set MyRelatedForm = DBForms.Open ("NameOfForm")
MyRelatedForm.Filter = "LinkFld2 = " & id
End Sub
Where:
-
LinkFld1 is the name of the field in your first form that contains the data you want to use to select the appropriate record in the second form (for example, if you had a customer table and an order table, this could be CustomerID).
-
LinkFld2 is the name of the field in the second form that relates to the first (for example, if you had a customer table and an order table, this could be CustomerID - i.e. often this will be the same actual name as LinkFld1).
-
NameOfForm is the name of the second form
An example of a very simple system of two linked tables can be downloaded here.
Open the form EmailForm, browse and use the button "Get Customer". Code is in the GetCustomer macro.