нет, оказываеться не зделал, та-же ошибка только в другом месте вот, посмотрите код Private Declare Function SetWindowPos Lib "user32" (ByVal h As Long, ByVal hb As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal F As Long) As Long Const SWP_NOMOVE = 2 Const SWP_NOSIZE = 1 Const flags = SWP_NOMOVE Or SWP_NOSIZE Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Private Sub Form_Load() res = SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags) 'Ôîðìà on-top Dim dbFile As String ' Ïðîâåðÿåò íàëè÷èå ôàéëà, èìåþùåãî èìÿ, êîòîðîå áóäåò ïðèñâîåíî íîâîé áàçå äàííûõ. Åñëè åñòü òàêàÿ áàçà, òî íîâàÿ áàçà íå ñîçäàåòñÿ, åñëè íåò òî âûçûâàåòñÿ ôóíêöèÿ è áàçà ñîçäàåòñÿ. If Dir(App.Path & "\TimeDB.Mdb") <> "" Then dbFile = App.Path & "\TimeDB.Mdb" Else: dbFile = dbgreit() End If End Sub Public Function dbgreit() 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 D.DatabaseName = App.Path & "/TimeDB.Mdb" D.RecordSource = "Time" D.Recordset.AddNew D.Recordset.Fields("Description") = "123789" Unload Me End Function ошибка в строке D.Recordset.AddNew D это компонент DATA
Ответить
|