срочно, помогите,на форме два таймера, и лайбе,(есть ещё картинки но это не важно), вылетает ошибка в вот таком коде: Dim n, n2 As Integer Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long Public Function DoesFileExist(ByVal strPath As String) As Boolean DoesFileExist = PathFileExists(strPath) End Function Private Sub Form_Load() n = 0 n2 = 1 frmMain.Show frmMain.Visible = False lblcheck.Caption = "" End Sub 'Private Sub tmrSiren_Timer() 'PicMain.Picture = p(n) 'n = n + 1 'If n = 16 Then n = 0 'End Sub Sub search() lblcheck.Caption = "Ïîèñê Áàçû Äàííûõ..." If DoesFileExist(App.Path & "/TimeDB.Mdb") = False Then n2 = 2 Else n2 = 4 End If End Sub Sub create() lblcheck.Caption = "Ñîçäàíèå Áàçû Äàííûõ..." Dim dbTimeDB As Database, NewWs As Workspace 'Îïèñàíèå ÁÄ è ðàáî÷åé îáëàñòè Dim dbOpts As Long, dbName As String, tbmain As TableDef Dim Desc, Sound, Types, Data, Time, Auto, Times As Field dbName = App.Path & "\TimeDB.Mdb" Set NewWs = DBEngine.Workspaces(0) ' Ñîçäàíèå ðàáî÷åé îáëàñòè dbOpts = dbVersion35 + dnEncrypt ' Ïàðàìåòðû ÁÄ - âåðñèÿ Jet-ìàøèíû 3,5 è êîäèðîâàíèå. Set dbTimeDB = NewWs.CreateDatabase(dbName, dbLangCyrillic, dbOpts) ' Ñîçäàíèå ðóñêîÿçû÷íîé ÁÄ Set tbmain = dbTimeDB.CreateTableDef("Time") Set Auto = tbmain.CreateField("Êîä", dbLong) ' Ñîçäàíèå ïîëÿ â òàáëèöå ñ èìåíåì Êîä Auto.Attributes = dbAutoIncrField ' Àòðèáóòû ïîëÿ - àâòîèíêðåìåíò tbmain.Fields.Append Auto ' Äîáàâëÿåì ïîëÿ â òàáëèöó Set Desc = tbmain.CreateField("Description", dbText, 200) Set Sound = tbmain.CreateField("Sound", dbBoolean) Set Types = tbmain.CreateField("Tipe", dbInteger) Set Data = tbmain.CreateField("Data", dbDate) Set Time = tbmain.CreateField("Time", dbDate) Set Times = tbmain.CreateField("Times", dbInteger) tbmain.Fields.Append Times tbmain.Fields.Append Desc tbmain.Fields.Append Sound tbmain.Fields.Append Types tbmain.Fields.Append Data tbmain.Fields.Append Time dbTimeDB.TableDefs.Append tbmain dbTimeDB.Close Data1.DatabaseName = App.Path & "/TimeDB.Mdb" Data1.RecordSource = "Time" n2 = 3 tmrStop.Interval = 3000 End Sub Sub create2() Data1.Recordset.AddNew Data1.Recordset.Fields("Description") = "123789" Data1.Recordset.Update n2 = 4 tmrStop.Interval = 1000 End Sub Sub wright() lblcheck.Caption = "Ïðèâÿçêà Áàçû Äàííûõ..." frmMain.D.DatabaseName = App.Path & "/TimeDB.Mdb" frmMain.D.RecordSource = "Time" n2 = 5 tmrStop.Interval = 3000 End Sub Sub searchFor() lblcheck.Caption = "Ôîðìèðîâàíèå ñïèñêà ñîîáùåíèé..." With frmMain.D.Recordset .MoveFirst If .Fields("Description") = "123789" And .RecordCount = 1 Then frmMain.lstall.AddItem "Íåò çàïèñåé" Exit Sub End If While Not .EOF frmMain.lstall.AddItem .Fields("Description") .MoveNext Wend End With n2 = 6 tmrStop.Interval = 1000 End Sub Sub endsett() lblcheck.Caption = "Çàãðóçêà ãëàâíîãî îêíà ïðîãðàììû..." frmMain.Visible = True Unload Me End Sub Private Sub tmrStop_Timer() Select Case n2 Case 1 Call search Case 2 Call create Case 3 Call create2 Case 4 Call wright Case 5 Call searchFor Case 6 Call endsett End Select End Sub
Ответить
|