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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: help with autoexec

Status
Not open for further replies.

Stevehewitt

IS-IT--Management
Jun 7, 2001
2,075
GB
Hey ppl,
i have a autoexec module which loads at startup. Goes like so:

Option Compare Database

Function AutoExec()

'Opens splashscreen for 4 seconds, closes, then opens switchboard

Dim lngPauseTime As Long
Dim lngStartTime As Long

'Loads up the status bar
varReturn = SysCmd(SYSCMD_INITMETER, "Please wait, loading ODBC connections", 20)

For intRecNum = 1 To 10
varReturn = SysCmd(SYSCMD_UPDATEMETER, intRecNum)
'updates the status from nothing to half
'Move to next record
Next intRecNum

DoCmd.OpenForm "frmSplash"
Forms!frmSplash.Repaint 'Opens splashscreen
lngPauseTime = 3 'Sets delay time
lngStartTime = Timer 'Get current time
Do While Timer < lngStartTime + lngPauseTime 'Wait
Loop

For intRecNum = 10 To 20
varReturn = SysCmd(SYSCMD_UPDATEMETER, intRecNum)
'Updates the status from half to full
'Move to next record
Next intRecNum

DoCmd.OpenForm &quot;Switchboard&quot; 'Opens switchboard
DoCmd.Close acForm, &quot;frmSplash&quot; 'Close splash

'Clears the status bar
varReturn = SysCmd(SYSCMD_SETSTATUS, &quot; &quot;)

End Function


When I run the application it starts and then saids that theres an error accessing the file, the network connection may of been lost.
The only file that this code relies on is the switchboard form and the splash screen frmSplash. These are both there and avaliable.

Any ideas? Its all on one file stored on the local machine, so its not a network issue.

Thanks in advance,

Steve Hewitt
Systems Manager
 
It has something do do with your SysCmd function statements. Here you are performing a SYSCMD_INITMETER which sounds like loading an ODBC connection. Well that is a connection that looks like can't be made. I would put a STOP command at the beginning of the AutoExec function and step through the code using the F8 key to see exactly which statement is erroring out.

This should help you identify where the problem is.

'Loads up the status bar
varReturn = SysCmd(SYSCMD_INITMETER, &quot;Please wait, loading ODBC connections&quot;, 20)

For intRecNum = 1 To 10
varReturn = SysCmd(SYSCMD_UPDATEMETER, intRecNum)
'updates the status from nothing to half
'Move to next record
Next intRecNum

Bob Scriver
 
Hey Bob.

The script does nothing. It displays the words &quot;please wait, loading ODBC connections&quot; in the status bar and opens a splash screen for 5 seconds. Then loads up the switchboard. I am creating this db locally, then upsizing to SQL, and use it via ODBC, hense the message in the status bar.

It hasn't got any ODBC connections on it as yet.

Any other ideas?

cheers Steve Hewitt
Systems Manager
 
I am suspecting that it has nothing to do with your application. If you application uses anything from your server: system.mdw, msaccess.exe, etc. Maybe it is in the shortcut to start the application. Maybe it is an automatic update of the version that is controlled in your shortcut process. But, something is trying to access a server connection. Try putting a STOP at the very beginning of the function, like right after the Dim statements. See if you get the error even before the code reaches the stop. If so then you will know if it is in your code or like I suspect someplace else.

Check all of your PC's server connections even if they are not part of your application. This kind of a error message sounds more like a server is down and your PC cannot access it.

I executed your code on my PC and it works just fine. So I really do suspect it is some other connection problem with your PC or server.

Bob Scriver
 
I was working on it at home, and emailed it at work. Then Terminal serviced the server at work to run it there. Could be a TS issue then.

I'll check it out tomorrow at the office.

Cheers, I'll be back! Steve Hewitt
Systems Manager
 
Hey ppl,

Many thanks, its working fine. One last thing. I have created a custom menu (Named user menu) that loads on start up. How do I get the standard access menu to vanish unless I bypass the startup (Shift key)??

Many thanks. Steve Hewitt
Systems Manager
 
Are you talking about the Database form that opens in design where you create and edit tables, form, queries, etc??? That can be done through your AutoExec.

Get back and explain exactly which form you are talking about. Also, is it maybe a Switchboard item that you want to delete?? You can use the SwitchBoard manager which is under the Tools menu, Addins.

Bob Scriver
 
Hey!

I have got a switchboard. Its all going great at the mo.

I have created a seperate user menu (E.g File, Edit, View etc) where there are limited commands and special buttons. I need to know how I can stop the normal menu bar (default one that comes with access) and start the custom one I have created. BUT only for users who start it up normally. I need to be able to bypass it by press &quot;Shift&quot; when loading.

Cheers
Steve Hewitt
Systems Manager
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top