Results 1 to 4 of 4

Thread: Connect to Access 97 Database w/ VB3 Pro

  1. #1

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393
    Hi gang,
    Is there anyway I can connect to a table created in the above version of Access? I'm trying to connect via the data control and it says that the database is corrupted or is not an Access database.
    Any idea?
    Thanks much
    JazzBass
    JazzBass
    In the .NET era
    Trying to remember VB6
    Progress:
    XP Professional @ Home
    and @ the Office

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Omaha, Ne
    Posts
    65
    You are probably trying to connect to a version of a database that was released after the ADO. You might have to code your connection the "manual" way. Just a hunch.

  3. #3
    New Member
    Join Date
    Mar 2000
    Posts
    2
    Are you sure that the control is pointing to the database??

    if so then why not try an SQL statment like

    DIM dbs as database, rst as recordset

    set dbs = opendatabase("c:\mydb.mdb")

    set rst = dbs.openrecordset _
    ("SELECT column1, column2 " _
    "FROM tbltable;" _

    or if you wanted to you could also make a condition like

    set rst = dbs.openrecordset _
    ("SELECT column1, column2 " _
    "FROM tbltable " _
    "WHERE column1 = 'whatever' " _
    "OR column2 = '" & a varable & "';")

    dbs.close

  4. #4

    Thread Starter
    Hyperactive Member JazzBass's Avatar
    Join Date
    Jun 1999
    Posts
    393

    Thanks! Another question

    Thanks for the input,

    I figured it would be something that is beyond what I know about databases.

    I have another question regarding how to post query results in Office 97 VBA

    Here is my code:

    Code:
    Sub cmdUpdate_Click()
    Dim dbs As Database, rst As Recordset
    Dim strVariable As String
    
    strVariable = Forms!StateSelectNew.cmbStateSelect
        
        
    strSQL = "SELECT DISTINCT * FROM OTC_SITES WHERE [SITE_STATE] = " & "'" & strVariable & "'"
        
        Set rst = dbs.OpenRecordset(strSQL)
        Set dbs = Nothing
    
    End Sub
    After the query runs, I don't get any feedback.
    Any ideas?
    Thanks
    Jazzbass

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