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

Trapping the "Server has not yet been opened" error in VB6/CR8

Status
Not open for further replies.

BungRee

Programmer
Dec 11, 2003
2
0
0
US
I have built a pretty robust VB6 application that is currently used to run CR reports on a scheduled basis with no human intervention. It uses the CR8 activeX control for most of the reporting functions. Because of the fact it's running 24x7, I've attempted to trap every error that I can think may occur, so it stays running.

------------Start Code Block--------------
For foo = 1 To CrxReport.Database.Tables.Count
LoginID = GetLogonID(CrxReport.Database.Tables(foo).LogOnServerName)
LoginPassword = GetLogonPassword(CrxReport.Database.Tables(foo).LogOnServerName)
If LoginID = "NoODBCConnectionExists" Or LoginPassword = "NoODBCConnectionExists" Then
Reports(ReportID).ErrorInSchedule = True
StatusText.SimpleText = "Total Schedules in Database: " & Str(ScheduleCount)
Exit Function
End If
CrxReport.Database.Tables(foo).SetLogOnInfo CrxReport.Database.Tables(foo).LogOnServerName, "", LoginID, LoginPassword
Next foo
---------------End Code Block--------------

As you can see, I have a seperate table of usernames / passwords that I match with the Server Name gathered from the report info. If the server doesn't exist, I can stop the report before it even tries logging in. The problem I've ran into is that if the reporting server is down, or if somebody screws up a username or password in the external file, then the ActiveX control tries logging in, and I get the dreaded "Server has not yet been opened" error message, and my program screams and dies. I have tried a couple things, but I'm stuck as to how to trap this message.

If anybody has any ideas, please let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top