Using Form Event Procedure

I’m in the middle of my test week with Panorama and I think I’m beginning to get a feel for things.

For example, I originally set up different databases with categories of information that would then be part of a relational group, but I found that for everything to be accessible each database would have to be open at all times (is this right?). This led me to simplify matters by combining all three databases into one called “Reference Information”. To identify each category of information, I affixed a letter prefix to each record index number, i.e., “H” for hotels, “R” for restaurants, etc.

I now have different forms to display each category of information, but only the appropriate category should appear when the form is called up—only hotel information in the “Hotels” form, for example. Selecting only records whose index number begins with “H” is the logical way to go, but only the data sheet has a search panel not forms.

Thus, I think I have to use a procedure to select the appropriate records. I’ve used the Procedure Recorder while in the data sheet to successfully select the records. But then I copied the procedure from the Recorder into the Form Event Procedure so this will be used whenever the form is opened—and I’m getting a syntax error.

Is everyone still with me? (Apologies for the length of this post.)

First, is combining databases and creating different forms an efficient way to go?
Second, is the Form Event Procedure the right tool to use for what I want to do?
Third, if it is, which statement is necessary to make the Form Event Procedure happy?

Much thanks for any guidance.

A correction—I wrote:

I was working in Graphics Mode when I wrote this; in Data Mode the search panel does appear. Nonetheless, can I have the Data Mode window open with just the “H” records showing?

There are many ways to skin this cat and identifying records with a category is one. The main thing is, when you create a procedure, it will appear in the action menu which is available on both the data sheet and forms. So, you could create a procedure that selects all the “H”s, then open the form for hotels with their info displayed. This could be a list of all hotels or a single hotel. You could put buttons on the form that go to other forms, so you could have a button on the Hotel form that would select the restaurants, then open the restaurant form.

Start by identifying what you want to do, how you want to make selections and how you want your forms to work. Then follow the plan.

You can do all this on one form using a single Text List Object and a Segmented Button (depending upon the number of different data types you want to list). Here is an example I threw together listing names from an existing database that start with first letter of the chosen segment name. In this example the Restaurant segment is selected and all names that start with “R” are selected. If the Hotels segment was chosen then all names beginning with “S” would be shown.

image

The Segmented Button is set to the variable dataType and the segments set to the three shown (more can be added).

image

The Text List Object was constructed using the List/Matrix wizard from the Construct menu as I imagine you have already done. In the Query section of the Text List Options panel I have entered a formula to select only those items that start with the first letter of the current value of the variable used in the Segmented Button (dataType in this case). The [1;1] is a text funnel that returns only the first letter of the value currently in dataType.

image

Now clicking on any of the segments will reload the list with the needed data.

Segmented

JeffK, gary, thanks for the suggestions which got me thinking along more profitable lines. I’ve got the result I want (and expected). Now on to the next challenge… (gary, your Segmented Button mention approaches a problem I’m having with Popup Menu Buttons and the non-persistence of the choice—when changing to another record and then going back to the first record the popup choice disappears—but that’s for another post.)