Hey VB PRogrammers-

Discussion in 'OT Technology' started by 2DR Vette, Jan 3, 2003.

  1. 2DR Vette

    2DR Vette We don't freestyle the Eyes of Texas, Big Boy.

    Joined:
    Feb 9, 2001
    Messages:
    64,635
    Likes Received:
    0
    Location:
    Eastern Seaboard Fission Authority
    Any of you guys ever use ADO and Access? WIll the two work together? I can't get a valid fucking connection string- it keeps crapping ou ton me. :mad:

    Here's what I've got:

    Code:
    Dim Cnxn As ADODB.Connection
    Dim rstStock As ADODB.Recordset
    Dim strCnxn As String
    Dim strSQLStock As String
    Dim varDate As Variant
        
    ' Open connection
    [color=red]strCnxn = "Provider='CompuStock Test'"[/color]
    Set Cnxn = New ADODB.Connection
    [color=yellow]Cnxn.Open strCnxn[/color]
        
        ' Open Stock table
        Set rstStock = New ADODB.Recordset
        strSQLStock = "Select * from Stock"
        rstStock.Open strSQLStock, Cnxn, adOpenKeyset, adLockOptimistic, adCmdTable
    
    I'm pretty sure the red line is what's causing me a hassle. THe yellow line is where teh debugger craps out with a "Provider cannot be found. It may not be properly installed" error. I know my ODBC is setup up correctly to point at the Access file..... ARGH!! :mad:



    Anyone kno how I can point this thing at an access database given only the path to the .mdb file? Little help- kenny you out there? VBGOD? Anyone?:o
     
  2. VBGOD

    VBGOD Guest

    How about a connection string to the actual file?

    Code:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=OT.mdb;Persist Security Info=False
     
  3. VBGOD

    VBGOD Guest

    My eyes are on fire, and I'm dead tired.

    Going to sleep within seconds.. :sleep:
     
  4. multiplexor

    multiplexor Intellectual

    Joined:
    Sep 12, 2001
    Messages:
    5,038
    Likes Received:
    0
    Location:
    Montreal Quebec Canada
    user the odbc designer instead... create a new... arg forgot the name... data environment and use that... much quicker and easier.

    :big grin:
     
  5. VBGOD

    VBGOD Guest

    strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=OT.mdb;Persist Security Info=False"
     
  6. 2DR Vette

    2DR Vette We don't freestyle the Eyes of Texas, Big Boy.

    Joined:
    Feb 9, 2001
    Messages:
    64,635
    Likes Received:
    0
    Location:
    Eastern Seaboard Fission Authority
    I'm trying it right now!! :eek:

    Damn, you're fast...
     
  7. VBGOD

    VBGOD Guest

    Re: Re: Hey VB PRogrammers-

    Dim rstStock As ADODB.Recordset
    Set rstStock = New ADODB.Recordset

    Dim ConnStr as string
    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=OT.mdb;Persist Security Info=False"

    rstStock.Open "Select * From Blah, ConnStr, 2, 2

    If rstStock.EOF=False
    Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
    Else
    rstStock.Addnew
    rstStock.Fields("Fieldwhatever").Value = Something
    rstStock.Update
    End If
     
  8. 2DR Vette

    2DR Vette We don't freestyle the Eyes of Texas, Big Boy.

    Joined:
    Feb 9, 2001
    Messages:
    64,635
    Likes Received:
    0
    Location:
    Eastern Seaboard Fission Authority
    Herb- I could :kiss: you!!!

    Thanks again, man. :) I'm going to be miserable here burning through the MSDN when you fall asleep. :o Where are you finding all this info? Everything I seem to be getting is all kinds of obstruse crazy info that's useless for Access queries. :sad2:
     
  9. VBGOD

    VBGOD Guest

    No problem. VB is my life. :o
     

Share This Page