If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Records cannot be read; no permissions on ...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-04, 15:58
REFIN REFIN is offline
Registered User
 
Join Date: Jul 2003
Posts: 20
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
Reply With Quote
  #2 (permalink)  
Old 01-24-04, 04:23
Rushi Rushi is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-26-04, 15:43
REFIN REFIN is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-27-04, 00:12
Rushi Rushi is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 01-28-04, 08:24
REFIN REFIN is offline
Registered User
 
Join Date: Jul 2003
Posts: 20
Quote:
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
Reply With Quote
  #6 (permalink)  
Old 01-29-04, 03:18
Rushi Rushi is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 01-29-04, 08:26
REFIN REFIN is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On