JavaScript Editor js editor     Web development 

Main Page

You can make it possible for users to add items to a list interactively.

To make it possible for users to add items to a list interactively

In the following example, when the user presses ENTER, the code in the KeyPress event of a text box adds the text in the text box to the list box and clears the text in the text box:

В Copy Code
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 13   && Enter Key
   THIS.Value = ""

You can make it possible for users to enter data in a table from a list. If the ControlSource Property is set to a field, whatever the user selects in the list is written to the table. This is an easy way to help ensure the integrity of the data in your table. While the user can still enter the wrong data, an illegal value cannot be entered.

For example, if you have a list of states or counties for a user to choose from, the user cannot enter an invalid state or county abbreviation.

You can make it possible for users to navigate to a record by picking a value from a list. Often, you want to let users select the record they want to view or edit. For example, you could provide users with a list of customer names. When the user selects a customer from the list, you select that customer's record in the table and display customer information in text boxes on the form. You can do this several ways, depending on the source of data in your form.

RowSourceType Selecting the appropriate record

2 - Alias 6 - Fields

When the user chooses a value in the list, the record pointer is set automatically to the desired record. Issue THISFORM.Refresh in the InteractiveChange event of the list to show the new values in other controls on the form.

0 - None 1 - Value 3 - SQL Statement 4 - QPR 5 - Array

In the InteractiveChange event, select the table that has the record with the desired values, and then search for the desired value. For example, if the RowSource holds customer identification numbers from the customer table, use this code:

В Copy Code
SELECT customer
LOCATE FOR THIS.Value = cust_id

See Also

JavaScript Editor js editor     Web development