Open a particular form on first opening of a database.

Emma

Registered User.
Local time
Today, 05:05
Joined
May 11, 2000
Messages
37
Hello!
Does anyone know how I can get a form to open on startup, if the value in a field in that form is null.

For example I have a form that should only ever open the very first time a database is opened, which the user must enter a name into a field. This information is then used in other parts of the database.

The next time they open the database, I just want it to show the normal menu screen.

I tried writing an autoexec macro, although I can get the form to open, this is every time the database is opened (and anyway I could do this though the startup options). When I tried putting a condition on the form it all went horribly wrong!

Any thoughts would be much appreciated!

Emma
 
Not the nicest way to do it, yet why don't you use the Startup Options to open the form. And then write a little bit of code on the Open_Form event of that form, which closes the form if the record in the database exists.
 
Here is the code:


Private Sub Form_Open(Cancel As Integer)

If IsNull(Me.YourField) Then

DoCmd.OpenForm "YourFormName", acNormal

End If


End Sub
 
Thanks to you both, your solution works well, and is alot nicer than the autoexec macro etc.

Emma
 

Users who are viewing this thread

Back
Top Bottom