Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loading a form on db start up 1

Status
Not open for further replies.

wendyd

Programmer
Jun 5, 2001
8
US
I have a requirement to load a form asking the user to enter personal information before the access switchboard can become available. After the user enters personal information (held in a personinfo table. only one record in this table), the switchboard starts.

Here is the logic.

On loading the switchboard, check to see if personal table field (or fields) for record 1 is null

If null, then load the personal info form. After saving and closing this form, load the switchboard.

If not null, then load the switchboard.

It's been a long time since I programmed vba. Any help is greatly appreciated!!!!

Thanks!!

- Wendy
 
create a macros with name autoexec and put there the commands. It'll be executed at startup John Fill
1c.bmp


ivfmd@mail.md
 
John,

I'm not sure about creating a macro named autoexec? Maybe a module? Can you give me more info? I'm a bit confused.

Thanks for your help!!!!
- Wendy
 
Maybe this will help - On the menu bar click Tools/Startup
this will give you the option of what form opens first. From there use the an Event Procedure in the login form to process the entry.
Hope it helps.
RGB
 
RGB,

I set the startup for the database to load the personal info form. Then in the form I put some code in the on_load event. This code came from various other posts I read. It seems to work fine. Any suggestions/improvements? I haven't created the switchboard form yet.

Private Sub Form_Open(Cancel As Integer)

Dim tmpValue As Variant

' hide form
Me.Visible = False

' get status from table
tmpValue = DLookup("[TMfirstName]", "[TM]")
If Not IsNull(tmpValue) Then
' close this form
DoCmd.Close
' open switchboard form
Else
Me.Visible = True
End If

End Sub

Thanks!!!
 
The code looks pretty solid.
My only suggestion would be to
re DIM tmpValue As String
Variant is useful if you don't know the type of
variable to expect but it takes a lot of memory space.
RGB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top