Results 1 to 5 of 5

Thread: [RESOLVED] database Access using Vb

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    20

    Resolved [RESOLVED] database Access using Vb

    I am trying to get data from MS access table using the code below. I am using VB6.3 and I have created ODBC as my_cn point to database file (.mbd). When I run this code, I get a runtime error 3001 "Argumant are of wrong type, are out of acceptable range or are in conflict with one another".

    When I click debug it highlights "rs.open..." code line.
    Please let me kow what missing.
    Thanks
    Question_1

    CODE:

    Private Sub form_load()
    Dim rs As ADODB.Recordset
    strSQL = "SELECT * from MasterTable where SWCR = 13;"
    Set rs = New ADODB.Recordset
    rs.Open strSQL, my_cn, adOpenStatic, adLockReadOnly

    retrieveValue = rs(0).Value
    MsgBox ("value:" & retrieveValue)
    rs.Close
    Set rs = Nothing
    End Sub
    Last edited by sprasoon; Aug 16th, 2007 at 12:53 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: database Access using Vb

    VB6.3 would be Access VBA

    Moved From FAQ section

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: database Access using Vb

    If you're in Access you don't use ODBC. Are you trying to connect to a Mysql db or similar? What is the code where you set your connection?
    Tengo mas preguntas que contestas

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    20

    Re: database Access using Vb

    Yes I am in MSAccess, have created a form bound to a table. I am trying to extract data from the table 'MasterTable' into a local variable in VB which I can use later in my code to apply to some equations.
    I am not a hardcore software. I am more into embedded tech so quite new to VB interface to MSaccess database.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    20

    Re: database Access using Vb

    Never Mind I got it myself. thanks anyways.

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