Second Start Up Form

Knildon

Learning by Default
Local time
Today, 15:28
Joined
Jan 19, 2012
Messages
89
Hello again,:)
Simple question, I hope.
I have a start up form that appears when the database is opened. The form has a checkbox to not show the form again on start up. I want a second form to become the start up form when the box is checked. I don't see an easy way to do that in the startup menu. Am I missing something?? Or, maybe I have to write code for that to happen.
Anyone have a quick and easy solution?
Thanks in advance for any and all help.
Don :confused:
 
You might try putting this in the on load event for the first form

Code:
If me.yourcheckboxname.value = -1
Then Forms!yourformname.visible=False
DoCmd.OpenForm ("YourSecondFormName")
End If
 
i would use an autoexec macro, calling a startup function

if flag then
docmd.openform "startup1"
else
docmd.openform "startup2"
end if
 
Alan,
That looks as though it will work if I can get the checkbox to stay checked between sessions. I have to find a solution to that problem now.

Dave,
I'm afraid you've gone one step above me with your solution. Although it still appears I'll need some type of checkbox (flag?) to contend with using your method.

I guess either way I go I'll need to figure out how to keep the checkbox checked.

Thanks for the suggestions. I'll keep working at it.

Don
 
For either solution, the saving can be acomplished with the checkbox bound to the recordsource of the form.
If the form already has a recordsource with other important data then put the checkbox in a subform in the header.

Dave's solution could check the status of the checkbox in the table by using a DLookUp.
 
Galaxiom,
My start up form is nothing more than some label boxes with instructions written in them. Once they have been read they are no longer needed.
I don't know how to bind a checkbox to a non data form.:confused:

I came up with some code to do what I want but it is far to complex for closing one form and opening another. Saving the checkbox setting would solve my problem. I could then use something like Alan suggested.

Any other thoughts??
Don
 
Create a table with one Boolean (checkbox) field and one record. You can optionally include an ID field to allow multiple boolean settings to be stored in the same table.

Enter this tablename in the RecordSource Property of the form.

Enter the boolean fieldname in the ControlSource property of the checkbox on the form.

Voila. The value of the checkbox will be automatically stored in the table.
 
Galaxion,
Thanks for the detailed description on the cure for my program ailments.:D I had a table that I used for saving miscellaneous data so I used that instead of creating a new one.
I ended up using a little advice from everyone and now the program does as I wanted it to do. I have a number of screens that can be opened and closed throughout the program so I used the same code here as I did for the other screens. It works well and prevents flashing. It's as follows in case someone else may want it:
Private Sub Form_Load()
If Me!SkipStartPage = -1 Then
stDocName = "MainMenuForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
stDocName = "StartForm"
DoCmd.Close acForm, stDocName, acSaveYes
End If
End Sub

Thanks again for everyone's help.:)
Don
 
BTW.
It is better to post code inside code tags.

You can also avoid the unecessary clutter that Microsoft uses in its examples.

Code:
stDocName = "MainMenuForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria

There is no point to setting a string variable to the form name and since there are no Link Criteria anyway it can be entirley omitted.

All you need is this one concise and to-the-point line:
Code:
DoCmd.OpenForm "MainMenuForm"

It doesn't need any variables declared for it either.



 
Galaxiom,
Thanks for the additional tips.:) I wondered how to get those code boxes to appear on the screen.
It also looks as though there is a command "#" at the top of this "Reply" screen that may do the same thing. I'll have to give it a try.
I have a bunch of those "Open/Close" commands throughout my program so I just kept them all uniform. Since I have some other issues to deal with maybe I'll go back and change them all to help preserve a little memory.;)
Thanks again for all your help.:D
Don
(Even an old dog can still learn new tricks!!!)
 

Users who are viewing this thread

Back
Top Bottom