Results 1 to 3 of 3

Thread: DAO help plz

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    How do i open a database, then a table and add new records to a table using DAO??

    Oh and how do i execute a qeury using DAO??

    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Open a database (this database has table-level passwords)
    Code:
        DBEngine.SystemDB = GetWindowsDir() & "MYAPP.MDA"
        DBEngine.DefaultUser = "MyUserName"
        DBEngine.DefaultPassword = "MyPassword"
        
        'Open the databases
        'gDB is defined as Database
        Set gDB = Workspaces(0).OpenDatabase(App.Path + "\MyDB.mdb")
    Open a table
    Code:
        Dim ssRecs As Snapshot
        Set ssRecs = gDB.CreateSnapshot("Select * From CoreLanguage order by DisplayOrder")
    Add new records
    Code:
        Dim dsSavedSystems As Recordset
        Set dsSavedSystems = gdbRWTU.OpenRecordset("SavedSystems", dbOpenDynaset)
        dsSavedSystems.AddNew
        dsSavedSystems!cboTransType = frmMain.cboTransType.ListIndex
        dsSavedSystems.Update
        dsSavedSystems.Close
    Query (a delete query)
    Code:
                    Dim SQL As String
                    SQL = "DELETE FROM SavedSystems WHERE SystemName = " & "'" & sSysName & "'"
                    gDB.Execute SQL, dbFailOnError




  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132

    Unhappy


    i am confused.
    Reality is an illusion caused by by lack of drugs

    Is this real or am i just having a dream?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width