Is there a way to make a Database on startup, prompt the user to choose a form to open?

Sampoline

Member
Local time
Today, 23:19
Joined
Oct 19, 2020
Messages
161
Just wondering if there is a way to make a database startup with a welcome message box and button to open a certain form. This means there is no form set to default open on startup. Let's say there are only 2 forms for now.

Will it be an AutoExec / Macro / VBA thing? Or is there a simpler way..? And if yes, how would I go about doing a macro for it.

So the process should run like this:

1- Opens Database
2- Welcome message box pops up, with the request to choose a form to open (if this has to be two separate steps that's fine too)
3- Clicks the button for that form
4- Form Opens
 
Could you make the welcome box actually a form, so you can add buttons and code to do what you want?
 
I always used a "switchboard" or "dispatcher" type of form. It was the opening form and when it popped up, it showed me buttons for the forms I was able to launch, one button per form. This opening form never closed but allowed any other form to move to the top, thus hiding the opening form while the other form was in use.
 
I always used a "switchboard" or "dispatcher" type of form. It was the opening form and when it popped up, it showed me buttons for the forms I was able to launch, one button per form. This opening form never closed but allowed any other form to move to the top, thus hiding the opening form while the other form was in use.
I didn't consider a switchboard form, that's really helpful actually. Thank you sir.
 
Another idea would be to have a start/welcome form with a combo box listing various forms for the user to choose from.
When a selection is made. open that form
If the user can select from any of the database forms, the row source used for the combo can be automatically created using the MSysObjects system table:
Code:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Type=-32768;

EDIT: I see @arnelgp has used a similar idea but with a listbox and creating a separate table to list the forms to select from
 
Another idea would be to have a start/welcome form with a combo box listing various forms for the user to choose from.
When a selection is made. open that form
If the user can select from any of the database forms, the row source used for the combo can be automatically created using the MSysObjects system table:
Code:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Type=-32768;

EDIT: I see @arnelgp has used a similar idea but with a listbox and creating a separate table to list the forms to select from
Oh yes I see what you mean, cheers for that!
 
Here's a custom switchboard and a modified Access switchboard along with some simple security
Wow this is very in depth Pat. I was actually after some help with creating User level security but wasn't clear on how to start. Thanks for the extra initiative.
 
The security in this example is simplistic and tied specifically to forms and actions on forms such as add/change/delete.

Hope you find it useful.
 
sample form.
Sorry to bring up this post again, just ran into an issue. So I used this template as a means to create a Switchboard for my database. I made 2 databases. One of them had no issues and works like a charm. The other one which has the exact same Switchboard (but different names for the list box and buttons). But whenever I try open the first form on the list, I am met with a run-time error 2501 openform cancelled. But when I select the next form down the list, it works.

Here is the code that was written for the Switchboard:

Code:
Private Sub cmdOpenForm_Click()
If Me.txtSelect.ListIndex = -1 Then
    MsgBox "Please select a form to open."
    Me.txtSelect.SetFocus
    Exit Sub
End If
DoCmd.OpenForm Me.txtSelect.Column(2)
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

txtSelect is my List Box
The code is running under my open form button_click

I can understand if the code didn't work for both my databases, but it is working for one and not working for the other. Both databases have the 2 forms. If that helps.

EDIT: So seems like my database corrupted somewhere. I exported my database to a blank one. All functions work correctly again. Not sure why that happened. But I guess as long as it's working, then no problem. Would still like to know if there is a reason why that happened. Thanks.
 
Last edited:
Sounds like your problem is with the form, not the code. Can you open that first form from the navigation pane?
 
Sampoline,
Are you using my sample?
Hi Pat

Yes I ended up using your sample to create my switchboard. Not too sure what happened with my previous database, but seems like all is fine now that I exported the database to a new one and deleted the old one.
 

Users who are viewing this thread

Back
Top Bottom