Linking a single record to a particular form

This may be a silly question, but is it possible to link specific records in a database to a particular form, so that by default they are always displayed using that form?

I’m asking this in relation to the equipment database I’ve imported from my previous database app (Bento). In this I list different types of technical equipment with their serial numbers, date bought, price paid, and technical specs. There are quite a few fields in common between different items of equipment, like a photo field and the first 3 items just mentioned; but for the technical specs I found I needed different forms for the different kinds of equipment: so I have separate forms for cameras, computers, printers and mobile devices; and a General form for everything else.

But then problem is that with Bento there was no way to specify that camera records must always be displayed using the Camera form, computers with the Computer form, and so on. It would seem clumsy to have five different databases for very similar types of data—and as I said, there’s a large degree of overlap between them. But as it is, I’m often scanning the screen for a particular type of info and not finding it—only to realise that, e.g., this printer record is being displayed with the Camera form, and cameras are not categorised as duplex or simplex!

I realise I may be going beyond what’s possible with a database app; but being so impressed with Panorama’s tremendous versatility, I just wondered if it might have a solution for this problem too!

Yes this could done, I expect in a variety of ways. I think this is a kind of navigation question. I know very little about your database, but imagine the following. When you open the database, you could go to a home screen that has a text list with all the equipment listed. That could be searchable to find particular piece of equipment or type of equipment. You could then double-click a line, which would trigger a procedure that would open a form for that particular equipment. The procedure can easily decide which form to open based on the data in that record, which I assume includes a field to identify the type of equipment. Easy!

My suggestion for this situation would be to have a primary form with a Tab Panel containing tabs for all your various catagories. If you already have a field with the different category for each record, then you can use that information to change the tabs in the primary form to the proper information. Using the automatic procedure .CurrentRecord you could change the tab depending upon what the current record was.

This is all somewhat advanced and will take a bit of learning and experimenting on your part to get it up and running. Basically the Tab Panel form will require a separate form for each of the tabs in addition to the displayed primary form. The primary form will take the info from the related hidden form and clone it for display when that tab is active. All this information is contained in the Help file under these topics:

Tab Panel Appearance
TabPanel Buttons and Selection
Tab Panel Constructor
Tab Panel Content
Tab Panel Object

The .CurrentRecord procedure is discussed here:

Bottom line is that you can do what you asked and possibly even better than you imagined.

Hey, thanks to you both for your helpful replies. As you said, Gary, they’ll take some reading-up and trying out on my part; but it’s great to know that it can be done! (By the way, I already have forms for each different category of equipment in my old database, so it will just be a matter of reproducing those in Panorama.)

I appreciate your input.

Hi Gary and CooperT,

Sorry to return to this topic, but I’m almost at the point of making this work, and there’s just a couple of crucial pieces of information that I don’t have.

I’ve set up a tab panel for my Equipment database, and I have 5 tabs for the different kinds of entries, with 5 matching forms. Clicking on the tabs switches to the correct form, no problem. (I decided to go with Gary on that, rather than your list, CooperT—but I think I would have hit a similar problem if I’d gone your way.)

Now I need to set up a procedure to open the correct form for the selected record, based on a field I’ve called “FORM TO USE”. But I’ve ground to a halt. I’ve looked everywhere I can think of in the Help, watched the Intensive Training course video on Tab Panels, and I simply cannot find anything about a formula to tell the app to switch to a particular form. In Help I found the OpenForm command, but this is about opening a form in a new window, not selecting it in the tab panel. I also can’t find anything about how I would reference the contents of the “FORM TO USE” field to provide the name of the target form.

I followed your link about the .CurrentRecord field, Gary, and I tried setting up a procedure with that name; but everything I entered there triggered a “Syntax error” message. That very short para you referred me to only says “[.CurrentRecord] could be used to initialize a variable or graphics object to display the newly current record”. It doesn’t give any example of how to do that.

I looked in the Help for “variable”, and found the topic about them. Sadly it didn’t help me understand how they would be used in a procedure. I’m obviously at a very basic level: I’m not any kind of scientist, mathematician or programmer; and I can’t afford your full Intensive Training Course. I would just like to get my databases as well set up as possible. For that it seems I’ll have to fall back on you more tech-savvy and experienced users for help—which hopefully will not be as often once everything’s basically up and running.

So thanks for your patience, and for any help you can give!

—Steve.

I found this a few months ago on the forum.

mytabPanelChoice = "SECOND"
ShowVariables mytabPanelChoice

Important- for this to work ,you have to rename the fileglobal variable “tabPanelChoice” (Tab Panel Options) that Panorama automatically creates. In the above example, I renamed it to mytabPanelChoice.

“SECOND” is the name of the TabPanel I want to select.

Fantastic! Thank you. So that’s how you get it to “push” a particular tab button.

It still leaves me with the problem, though, of how to get it to look at my “FORM TO USE” field and extract the necessary tab name for each record from there. So, using your example, one record may have “SECOND” in the “FORM TO USE” field, another may have “FIRST”, another “THIRD”, and so on. My hope is that I’d be able to get it to select the correct button for whichever field is currently being viewed.

Assuming the Tab Panel variable is still named tabPanelChoice, you would put this code in the .CurrentRecord procedure:

tabPanelChoice=«FORM TO USE»
showvariables tabPanelChoice

Now the Tab Panel will automatically go to the proper tab when the record is changed.

I just noticed that if your “FORM TO USE” field is empty you can crash Panorama when you go to such a record. With that in mind I would include a trap in the above code to prevent this problem.

If C=""
    stop
Endif
tabPanelChoice=C
showvariables tabPanelChoice

THAT DID IT! Thank you so much. I created the .CurrentRecord procedure and pasted that code, plus the trap at the top; and it now does exactly what I wanted, selecting the correct form for each record. I also created a new record, then moved away from it and back to it while all the fields were still blank: Panorama didn’t crash—so I assume the trap was working.

My sincere thanks to all of you for helping me set this up.