VB6 with Access 2000

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • callsupport1
    New Member
    • Jul 2007
    • 18

    VB6 with Access 2000

    Hi Can you please help, I am new to this so please be gentle!

    I have written the following code using VB6 and Access2000 and I recieve a Run-Time error '3343' unrecognized format'S:\RdiIn tranet\RDiIntra net.mdb' , when running the code.

    [CODE=vb]Public rstSuppliers As DAO.Recordset
    Public dbSuppliers As DAO.Database

    Private Sub Form_Load()
    ' *************** *************** ** RDi Suppliers *************** *************** ***
    Set dbSuppliers = OpenDatabase("S :\RdiIntranet\R diIntranet.mdb" )
    Set rstSuppliers = dbSuppliers.Ope nRecordset("Sel ect * From Suppliers order by ACCOUNT_REF")
    rstSuppliers.Mo veFirst
    End Sub[/CODE]

    I think it's because i am using Access 2000, can you please help.


    Thanks
    Steve
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by callsupport1
    Hi Can you please help, I am new to this so please be gentle!

    I have written the following code useing VB6 and Access2000 and i recieve a Run-Time error '3343' unrecognized format'S:\RdiIn tranet\RDiIntra net.mdb' , when running the code.

    Code:
    Public rstSuppliers As DAO.Recordset
    Public dbSuppliers As DAO.Database
    
    Private Sub Form_Load()
        ' ******************************** RDi Suppliers *********************************
            Set dbSuppliers = OpenDatabase("S:\RdiIntranet\RdiIntranet.mdb")
            Set rstSuppliers = dbSuppliers.OpenRecordset("Select * From Suppliers order by ACCOUNT_REF")
            rstSuppliers.MoveFirst
    End Sub
    I think it's because i am using Access 2000, can you please help.


    Thanks
    Steve
    Have you tried using Ado, callsupport1!

    I am going to see about an example in DAO. I am almost certain something like this is possible through Ado.

    I also run two 2000 I don't seem to have any problems.

    In a bit!
    Last edited by Dököll; Jul 4 '07, 04:32 PM. Reason: Code tags and reply

    Comment

    • Dököll
      Recognized Expert Top Contributor
      • Nov 2006
      • 2379

      #3
      I think we can work with this one, I have it linked to one of my databases on C, fired right away, pretty easy code. You'll need to do all the work, a little digging you'll figure it out:
      Add this in Form_Load
      Code:
      Private Sub Form_Load()
      Dim my_database As Database    'dimension database as database
      Dim my_record As Recordset
      Dim test As String
      Text1(0).Text = "123456*" my user ids all start at 123456
      test = Text1(0).Text
      Set my_database = OpenDatabase("C:\Data_Central.mdb")   'this function will open the database using the link to the access database (besure database is closed)
      Set my_record = my_database.OpenRecordset("select * from Employee where UserID like '" & Text1(0).Text & "'")    'search by UserID, only if data already exist
         Do While Not my_record.EOF  'this function will keep searching for fields matching each textbox
         
              Text1(0).Text = my_record.Fields("UserID")
              Text1(1).Text = my_record.Fields("EmployeeID")
              Text1(2).Text = my_record.Fields("TodayDate")
      
              '... and so on
      
              my_record.MoveNext
         Loop
         my_database.Close
      End Sub
      It's a little clumsy but it should get you started. It is also in DAO, you'll need to reference Microsoft DAO 3.6 Object Library.

      I would also load Adodc control to page through the data loading in your textboxes, 1234567, 1234568, 1234569 and so on.

      Let us know how you make out...
      Last edited by Dököll; Jul 4 '07, 05:44 PM. Reason: Added remark...

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by callsupport1
        ...unrecognized format'S:\RdiIn tranet\RDiIntra net.mdb'
        I wonder whether this might indicate that the MDB file was created by either an older or a newer version of Access than what your system can handle.

        Comment

        • Esmael
          New Member
          • Feb 2007
          • 58

          #5
          Originally posted by callsupport1
          Hi Can you please help, I am new to this so please be gentle!

          I have written the following code using VB6 and Access2000 and I recieve a Run-Time error '3343' unrecognized format'S:\RdiIn tranet\RDiIntra net.mdb' , when running the code.

          [CODE=vb]Public rstSuppliers As DAO.Recordset
          Public dbSuppliers As DAO.Database

          Private Sub Form_Load()
          ' *************** *************** ** RDi Suppliers *************** *************** ***
          Set dbSuppliers = OpenDatabase("S :\RdiIntranet\R diIntranet.mdb" )
          Set rstSuppliers = dbSuppliers.Ope nRecordset("Sel ect * From Suppliers order by ACCOUNT_REF")
          rstSuppliers.Mo veFirst
          End Sub[/CODE]

          I think it's because i am using Access 2000, can you please help.


          Thanks
          Steve

          Hi Callsupport1... .


          Yeah... i also encountered that problem when am starting on VB...
          Your idea is correct... its because of the MS Access version.

          You dont have to do anything more on your given codes... all you have to do is to changed your referenced:


          If you are referencing to
          Microsoft DAO 3.5 Object library

          changed to:
          Microsoft DAO 3.6 Object library


          I hope this one will works on you....
          (besides maybe you dont need control like datacontrol for this... because you
          might have included it to your given source code if it is so...)



          Good Luck!

          Comment

          • callsupport1
            New Member
            • Jul 2007
            • 18

            #6
            Originally posted by Esmael
            Hi Callsupport1... .


            Yeah... i also encountered that problem when am starting on VB...
            Your idea is correct... its because of the MS Access version.

            You dont have to do anything more on your given codes... all you have to do is to changed your referenced:


            If you are referencing to
            Microsoft DAO 3.5 Object library

            changed to:
            Microsoft DAO 3.6 Object library


            I hope this one will works on you....
            (besides maybe you dont need control like datacontrol for this... because you
            might have included it to your given source code if it is so...)



            Good Luck!
            Hi Thanks for the reply, I am new to VB6 and am not sure how to reference Microsoft DAO 3.5 Object library in my code.

            Regards
            Steve

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by callsupport1
              Hi Thanks for the reply, I am new to VB6 and am not sure how to reference Microsoft DAO 3.5 Object library in my code.
              Pull down Project menu, select References, then hit the checkbox next to the desired reference, and click OK.

              Comment

              • Pramodraya
                New Member
                • Jun 2007
                • 6

                #8
                Hi Killer,
                In the below VB code I want to input "password" in encripted format using InputBox, please help me in this regard

                [CODE=vb]Dim Pwd As String = String.Empty
                Dim Obj As Object
                Pwd = InputBox("Enter the password", "Security")
                If Pwd = "Password" Then
                Dim oSettings As New Settings
                oSettings.ShowD ialog()
                LoadXml()
                ElseIf Pwd = "" Then
                Else
                MessageCall("In avalid password", MessageBoxButto ns.OK)
                End If[/CODE]
                Last edited by Killer42; Jul 28 '07, 12:38 AM. Reason: Added [CODE=vb] tag

                Comment

                Working...