How can I create a button to open a separate base form of same record?

I have a database with various fields, including several images (it’s stored on a MySQL server with the odb only containing forms and reports and such). But there’s just not enough room on a given form to display all the images unless I shrink them way down. So I created a couple of alternate forms that link to the other image fields. What I want is to have the main form open and then have a couple of buttons for “Image set 1” and “Image set 2” that belong to the same record as is in the main form. I know i have to create macros and use the basic stuff, but I’m at a loss as to how to do that. I searched around and found some ideas, but they are for the 5.x.x versions of LibreOffice and so didn’t work.

Can someone please give me some ideas, or explain exactly what basic code I need to use? Basically it’s this logic:

Button1_Press → ShowForm(Form2, Form1.RecNo)

Button2_Press → ShowForm(Form3, Form1.RecNo)

Then in each form there would be logic in the ShowForm that obtains the correct record in the table and displays the images.

Thanks!

See outline answer below

@FunkyDan This answer is an OUTLINE only. You can use a FILTER TABLE to store the record ID you want to show on your separate form. You will need to be proficient at FORM DESIGN to achieve this. It is likely to be easier to do it with this technique than by using a macro. See THIS POST (for example). Or this other post for idea on a macro to do it. (See comments below).

UPDATE: I’ve also added an outline on how to display a group of images in your form.

The macro idea is not bad, but the poster says he’s getting update issues. That could be an issue for me. I have created the table, but it’s currently empty and I want to populate it. Each record can have up to 20 images, and since images can take up a fair amount of screen space I created separate forms for separate image sets. What I need to be able to do is load the main form, enter data on it, then click on a button to add additional images to the record, then close the secondary form, save the record in the main form, and continue. If necessary I will close image form 1 and open image form 2 to continue inserting images into the record.

So I guess I need two macros. Macro one is used to open a particular image form after saving the record in the main firm, and macro two is used when the form closes to add the images to the previously saved record. I’ll try to play around with the macros and perhaps I’ll get lucky.

What I wouldn’t give for an IDE with autocomplete so that I can say form1. and then it pops up a dialog showing the possible function calls.

Same error. I don’t know what I’m doing wrong, but I get an error saying the object is not set whenever I run the code to access the form. Here’s what I’ve got so far (note, this is very much a work in progress):

sub OpenImgForm
Formno = 2 ’ Set as a test point. Remove for final production
Mainform = oEvent.Source.Model.Parent
IDNo = MainForm.GetByName(“edtIdNo”).text
SubForm = ThisDatabaseDocument.FormDocuments.getByName(“AD_Pics” + Formno)
oEvent.Source.Model.commit
Mainform.updateRow
SubForm.open
end sub

Problem is that every time I call oEvent.Source.Model.Parent it gives the error. BASIC runtime error. Object variable not set.

I am still hoping for some kind of solution here. It simply is not possible to design a form large enough to handle all the images that could be displayed with this project. Not without shrinking the images to ridiculously small sizes that would obscure details. So the only way I can think of is to have separate forms for groups of images, i.e. main form has the textual information and first four images, then form2 has the next four images, and so on. Each form to be opened by a button. On changing record, the button opens the form again with the correct images. Putting buttons in is easy. But I have been unable to write any basic code that would allow the form to open, let alone sync the image controls with the correct record. Since posting basic code here looks UGLY, you can check out this link. The error I’m getting is that an argument is not optional, on the Mainform = line.

The filter table may work, but only if I can get the basic code to open another format in the first place

Well, you could think about having your image control and image display box in a sub-form and then just use forward & back arrows to ‘move’ though all your images. No need to have many form windows to open (and close).

Not a bad idea, but I’ve never worked with subf-orms before. Does Base automatically sync against record ids or do I have to do that? As it stands, the database has two tables. one for the main record and one for an image attached to the main record. I can change that if I need to, but regardless, what would be sweet is if the sub form could display two images and have a button to advance to the next two. Can I do this? If so, can you point me in the right direction?

The way I achieved displaying multiple images viewable by ‘forward-and-back’ buttons on a single form was to define a SET of images. Your SETS could be different meaningful categories (like fruit, logos, people, etc.) or they could just be arbitrary (like 1,2,3…). The basis of this approach is having a so-called ’ junction’ TABLE which holds (on each of its rows) a primary key PK (integer), a set ID FK (integer), and an image ID FK (integer) - these last 2 are both foreign keys (FKs). The FORM you design would have a sub-form hierarchy that will let you move through the sets of images, and, within a set, to move through all the images belonging to that selected set. In theory, I think it would be possible (though a bit more complicated) to show PAIRS of images in your form. You would have to display the CURRENT and PREVIOUS images in a set, using the settings of TWO image controls.

Since I’ve never used, or even heard of, a filter table before this, I’d appreciate it if you could point me in the right direction. Is a filter table even possible with a MySQL backend?

A FILTER TABLE is simply a table usually with a single record which ‘stores’ the ID of a single (chosen) record from another table. Usually, a LIST BOX is used to choose a record whose ID is to be stored in the FILTER TABLE record. For example, the user chooses a person’s name from a drop-down list, and the ID primary key (PK) of that person’s record (as stored in a contacts table) is written to the FILTER table record. See HERE for more detailed information.
NOTE: a FILTER table is not the same as a JUNCTION table.

Hello,

You can open a form from another form at a specific record with specific information. It does require the use of macros (not an easy topic to cover).

See:

and