Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Posts
    20

    Unanswered: Records cannot be read; no permissions on ...

    Hi All,

    Newbie question. We are having a difficult time reading from a recordset in an Access table from vb6. We receive the following error

    Record(s) cannot be read;no read permission on 'tblVersion'

    Here is the code:

    Private Sub Form_Load()

    Dim conn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim sConnection As String

    '*** Establish Connection to Back End Database
    sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
    "Source=\\ESI-Sum-Program\C-17 EDL\Databases" & _
    "\PriceTracker\PTBE\PT_be.mdb;"

    conn.Open sConnection

    '*** Determine if Connection Made
    If conn.State = adStateOpen Then
    '*** Do Nothing - Connection Works
    MsgBox "Welcome to PriceTracker!"
    Else
    MsgBox "The Connection Could Not Be Made."
    End If


    '***** Error occurs here ******
    Set rs = conn.Execute("SELECT * FROM tblVersion")
    rs.MoveFirst
    lblVersion.Caption = "Version " & rs!Version
    lblPlatform.Caption = rs!Platform
    lblVersionDate = rs!VersionDate


    End Sub

    If we try to run this same code against a copy of the database on a local C: drive it works fine. What are we doing that causes the failure on a network drive.

    We really appreciate any help you may provide. This is part of a government tracking program and as such the need to resolve is relatively urgent. Being newbies we are lost. Help us please.

    Thank you all very much

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    62
    Try this. This may solve your problem.
    Create a DSN and use the DSN when you pen your database.
    instead of hardcoding the path in the code.
    Go to start button - > setting ->control pannel
    Click on ODBC data source.
    Press Add button.
    select Microsoft Access Driver (*.mdb)
    It will display another screen where you can put the name of data source and by pressing select button you can specify the path of the data base. Here select the machine on the network which has the database.
    Assume you specify the name as TEST.
    while opening the data base use the following code
    (if con is your connection)

    call con.open ("test", , ,)
    or call con.open "test"
    Try this code.
    GOOD LUCK
    Regards,

    Rushi

  3. #3
    Join Date
    Jul 2003
    Posts
    20
    Hi Rushi,

    Thank you for your reply. I tried as you suggested and I found that on the "ADD" screen a Microsoft Access Driver (*.mdb) already exists. Please bear with me I am a newbie, Do I add another one? I guess I don't know enough to go forward.

    Thanks again for your help and your patience. I do appreciate it.

    Refin

  4. #4
    Join Date
    Jan 2004
    Location
    India
    Posts
    62
    Yes. Add another one. Give it a name in the data source name box and specify the path of the database.
    steps:
    1) Press select button
    2) on the next screen press Network button
    3) select a drive letter and select a path. (Diff machines on the network are displayed)
    4) select .mdb file from this path.
    5) You will come the first screen.
    Press OK and as I had stated earlier, use the data source name DSN in your code
    Call con.open ("dsn name")
    Regards,

    Rushi

  5. #5
    Join Date
    Jul 2003
    Posts
    20
    Originally posted by Rushi
    Yes. Add another one. Give it a name in the data source name box and specify the path of the database.
    steps:
    1) Press select button
    2) on the next screen press Network button
    3) select a drive letter and select a path. (Diff machines on the network are displayed)
    4) select .mdb file from this path.
    5) You will come the first screen.
    Press OK and as I had stated earlier, use the data source name DSN in your code
    Call con.open ("dsn name")

    Hi Rushi,

    I followed our procedue and got the program to work. Thank you very much for your help. Do have one further question though, this works for my computer but will this have to be done on each computer that will be running the application?

    Thanks again for your help. It is sincerely appreciated.

    REFIN

  6. #6
    Join Date
    Jan 2004
    Location
    India
    Posts
    62
    Where you run the application, just create the same DSN with the required path.
    The advantage of using a DSN is obvious.
    You don't have to edit your code for it. You just create DSN with ODBC utility which is available in every machine.
    If you change the path of your database, i.e. mdb file, again you don't have to change your code. No need to build the exe file again.
    Just change the DSN.
    Regards,

    Rushi

  7. #7
    Join Date
    Jul 2003
    Posts
    20
    Hi Rushi,

    Thanks for the reply. Thank you very much for all your help and patience with a newbie. I sincerely appreciate it

    REFIN

Posting Permissions

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