module.bas

来自「VB6.0下对Access数据库文件进行查找、添加、删除记录的源代码!」· BAS 代码 · 共 26 行

BAS
26
字号
Attribute VB_Name = "Module"


' First we have the two most inportent part of database using, infect the two only objects
' that need to be used when working whit database.
Public db As Database ' DAO->Database object, used to do load the database.
Public rsData As Recordset ' DAO->RecordSet object, used to store Database records.
' We have more then one Recordset object, and use the same Database object for them all.


' ---------------------------------------------------------------------------------------
' Sub Main()
' I allways use whit when i start programs, It allows me to do all memory loading before
' the main window is shown.
Sub Main()
    ' First we need to open the database, we do that by using OpenDatabase, and Set it to our db object
    Set db = OpenDatabase(App.Path & "\Test Database.mdb") ' DAO->DBEngine->OpenDatabase
    
    ' Next we open the Table into the Recordset object, We do this be using db.OpenRecordset
    Set rsData = db.OpenRecordset("Work") ' DAO->Database->OpenRecordset
    'If we are going to use more then one Recordset object, then use the same funcsion as we just used.

    'Now we are done loading the database and its time to show the ain window.
    frmMain.Show
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?