home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 4.00 Begin VB.Form Cover_scr BackColor = &H00C0C0C0& Caption = "Stand-Alone VB DB Application" ClientHeight = 5130 ClientLeft = 900 ClientTop = 1215 ClientWidth = 8190 FillColor = &H00C0C0C0& FillStyle = 0 'Solid BeginProperty Font name = "MS Sans Serif" charset = 1 weight = 700 size = 8.25 underline = 0 'False italic = 0 'False strikethrough = 0 'False EndProperty ForeColor = &H80000008& Height = 5820 Icon = "COVER_SC.frx":0000 Left = 840 LinkTopic = "Form2" MaxButton = 0 'False Picture = "COVER_SC.frx":030A ScaleHeight = 5130 ScaleWidth = 8190 Top = 585 Width = 8310 Begin VB.PictureBox Picture1 Appearance = 0 'Flat BackColor = &H00C0C0C0& BorderStyle = 0 'None ForeColor = &H80000008& Height = 1935 Left = 3120 Picture = "COVER_SC.frx":0700 ScaleHeight = 1935 ScaleWidth = 1935 TabIndex = 2 Top = 1560 Width = 1935 End Begin VB.CommandButton btnExit Caption = "E&xit" Height = 615 Left = 6240 TabIndex = 1 Top = 3960 Width = 1455 End Begin Threed.SSCommand btnAccounts Height = 855 Left = 5400 TabIndex = 5 Top = 360 Width = 1455 _version = 65536 _extentx = 2566 _extenty = 1508 _stockprops = 78 caption = "&Accounts" picture = "COVER_SC.frx":2E42 End Begin Threed.SSCommand btnCustMain Height = 855 Left = 1320 TabIndex = 4 Top = 360 Width = 1455 _version = 65536 _extentx = 2566 _extenty = 1508 _stockprops = 78 caption = "&Customer Files" picture = "COVER_SC.frx":315C End Begin Threed.SSCommand btnCoInfo Height = 855 Left = 3360 TabIndex = 3 Top = 3840 Width = 1455 _version = 65536 _extentx = 2566 _extenty = 1508 _stockprops = 78 caption = "Company &Info" picture = "COVER_SC.frx":3476 End Begin VB.Label Label1 Appearance = 0 'Flat BackColor = &H00C0C0C0& Caption = "Version 1.0" ForeColor = &H00C00000& Height = 255 Left = 6240 TabIndex = 0 Top = 4680 Width = 1695 End Begin VB.Menu mnuFile Caption = "&File" Begin VB.Menu mnuCompany Caption = "&Company information" End Begin VB.Menu mnuBar1 Caption = "-" End Begin VB.Menu mnuExit Caption = "E&xit" End End Begin VB.Menu mnuEdit Caption = "&Edit" Begin VB.Menu mnuEditCustomers Caption = "&Customers" End Begin VB.Menu mnuEditLine1 Caption = "-" End Begin VB.Menu mnuEditAccounts Caption = "&Accounts" End End Begin VB.Menu mnuHelp Caption = "&Help" Begin VB.Menu mnuHelpGetStarted Caption = "How to get started" End Begin VB.Menu mnuHelpAbout Caption = "&About this application" End End Attribute VB_Name = "Cover_scr" Attribute VB_Creatable = False Attribute VB_Exposed = False Private Sub btnAccounts_Click() MousePointer = 11 'hourglass frmAccounts.Show 1 'modal End Sub Private Sub btnCoInfo_Click() MousePointer = 11 ' hourglass CoInfo.Show 1 'modal End Sub Private Sub btnExit_Click() End End Sub Private Sub btnCustMain_Click() MousePointer = 11 ' hourglass Custinf.Show 1 'modal End Sub Private Sub Form_Activate() ' Reset to the default pointer when returning to this form. MousePointer = 0 End Sub Private Sub Form_Load() Dim errmsg As String Dim response As Integer 'Center the form Left = (Screen.Width - Width) / 2 Top = (Screen.Height - Height) / 2 ' You could add an API call to check an initialization file ' for a database name and location instead of defaulting to ' the names in this example. App_location = "\source\chap35\" ' Remember backslash at end! If Not Database_name Then Database_name = App_location + "vb4db.mdb" End If On Error GoTo Error_db ' Open single user. Set CustDB = OpenDatabase(Database_name) Exit Sub Error_db: Select Case Err Case 3049 ' Possible corrupt database errmsg = Err.Description & " To attempt repairing the database, press OK. To Abort, press CANCEL" response = MsgBox(errmsg, vbOKCancel, "Database Error") If response = vbOK Then MousePointer = 11 DoEvents Cover_scr.Print "Re-indexing tables..." RepairDatabase Database_name Cover_scr.Print "Optimizing tables..." CompactDatabase Database_name, "\tmpdb.mdb" Cover_scr.Print "Resetting tables..." Kill Database_name Name "\tmpdb.mdb" As Database_name Cover_scr.Refresh MousePointer = 0 Resume End If Case Default errmsg = Err.Description & " Press Yes to continue anyway (could be risky), No to exit. Continue anyway?" response = MsgBox(errmsg, vbYesNo + vbDefaultButton2, "Database Error") If response = vbYes Then Resume ' Attempt to continue Else End ' Shut down the application End If End Select End Sub Private Sub mnuCompany_Click() CoInfo.Show End Sub Private Sub mnuEditAccounts_Click() Call btnAccounts_Click End Sub Private Sub mnuEditCustomers_Click() Call btnCustMain_Click End Sub Private Sub mnuExit_Click() End End Sub Private Sub mnuHelpAbout_Click() Call Picture1_Click End Sub Private Sub mnuHelpGetStarted_Click() MsgBox ("This is the main screen for this application. To access an area, move the mouse pointer to one of the buttons and 'double-click' on it, or click once and press the Enter key. Press enter or click OK to continue.") End Sub Private Sub Picture1_Click() MousePointer = 11 'Hourglass About.Show 1 'modal End Sub