Open form with same columns visible on startup (1 Viewer)

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
Hello,

I am using AutoExec to always start with the same form. This form has a header and then a table. I have added a button to the form that allows people to hide and show columns, this button was a predefined button that was available. However, the selection is then saved. I would like to add something to my AutoExec, so that on startup it is always the same columns that are visible.

Does anyone have any pointers or me on how to do this?

Unfortunately, my place of work does not allow Modules.

Best,
Max
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
Add the ColumnName of your table in another table.
Add another Column (Visible) Yes/No to signify if it is visible or not.
add macro on the form to check this table and Hide/Show column
depending on the Visible column.
add macro when you close the form to save the "current state" of each
column.
 

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
I'm sorry, but I don't know how to "to check this table and Hide/Show column depending on the Visible column"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
can you show a snapshot of your form?
 

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
I have created a sort of minimal example. Let's say, on startup I want only first name and surname to be visible, but birthdate to be hidden. By using the button, it is possible to make birthdate visible as well, but after saving, closing and reopening the file it should again only be first name and surname that are shown.

screenshot1.JPG
screenshot1.JPG
screenshot2.JPG
screenshot3.JPG
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
what i can think is Remove the Close (X) from your form and add a Button that will close the form.
the button will save the form when closed.
 

Attachments

  • linkedByID.accdb
    608 KB · Views: 201

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
I have removed the close (X) from the form, I don't understand what that has to do with opening it up with the same columns hidden / shown every time? I do want to save all of the other changes, I just want to make sure that on startup, I show the same columns. That's why I thought I should add this somehow in my AutoExec Macro.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
did you see the sample form i made, i added a Close button and when you click it
it will save whatever changes you made to the "form".
so it keeps whatever column is hidden/shown next time you open it again.
 

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
I am sorry, reading my question again, I may have been unclear: it's not that the shown/hidden column configuration isn't saved, but I would like it to be, it is rather the other way around - the configuration is being saved but I would like to disregard this information and ALWAYS show the same, specific columns by startup, i.e., first name and surname in my example above.

However, right now, if one user chooses to show birthdate as well and then closes the file with all three columns visible, they will also be all visible for the next person that opens the file. I don't want this, I want the file always to show first name and surname only.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
see again the demo.
open the form (master1) in design view and see the code on Open event.
i want ID and Parent Name fields to be always visible when the form opens.
 

Attachments

  • linkedByID.accdb
    832 KB · Views: 218

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
Thanks, but unfortunately I am only allowed to use Macros and not VBA code and modules...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
same thing Don't save the form when you close it.
 

Attachments

  • linkedByID.accdb
    992 KB · Views: 204

maxgold

New member
Local time
Today, 02:45
Joined
Jan 28, 2022
Messages
20
Thanks, but that doesn't really solve my problem. People are going to save the form sometimes, I know that I regularly hit ctr+s while working out of a habit. As soon as I do this, the form is saved and then birthdate is visible when I open up the file again.

That's why I would like to set this, if at all possible, in the AutoExec script, because then I can be sure that no matter what the users do, it will open up with the correct columns visible..
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:45
Joined
May 7, 2009
Messages
19,169
you need to Open your from through macro.
double click on the macro.
 

Attachments

  • linkedByID.accdb
    992 KB · Views: 201

Users who are viewing this thread

Top Bottom