Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - first time doing vbscript need help pls

Reply
 
Old 07-11-2009   #1 (permalink)
franco monte


 
 

first time doing vbscript need help pls

I have a Windows Script Host (xp pro service pack 3) that delete a
file access 2000 without password but I get the message :
Impossible read record. Autorization of read not avaiable for
"MyTable"(this is my traduction)
Code: 80040E09
I put "Everyone" group with full control policy but is just the same!


Dim rst
Dim strSQL
Dim gdbConn
strSQL = vbNullString
strSQL = strSQL & "Delete from MyTable" ' etc...
Call GetDataConnection()
Set rst = gdbConn.Execute (strSQL)
Set rst = Nothing
Call CloseDataConnection()

'===========================
Function GetDataConnection()
'===========================
Dim strConn

Set gdbConn = Nothing
Set gdbConn = CreateObject("ADODB.Connection")
gdbConn.Provider="Microsoft.Jet.OLEDB.4.0"
strConn = "C:\Cancella\MyMDB.mdb"
On Error Resume Next
gdbConn.Open strConn
If err.number <> 0 Then
Msgbox err.description, vbExclamation+vbOkOnly, "Database Connection
Error"
End If

Set GetDataConnection = gdbConn
blnConnect = True
End Function

'========================
Sub CloseDataConnection()
'========================
If Not(gdbConn Is Nothing) Then
gdbConn.Close
Set gdbConn = Nothing
End If
End Sub

My System SpecsSystem Spec
Old 07-11-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: first time doing vbscript need help pls


"franco monte" <montefm@xxxxxx> wrote in message
news:2dfff34e-8b4d-4d48-b09b-979e2c56ae0e@xxxxxx
Quote:

>I have a Windows Script Host (xp pro service pack 3) that delete a
> file access 2000 without password but I get the message :
> Impossible read record. Autorization of read not avaiable for
> "MyTable"(this is my traduction)
> Code: 80040E09
> I put "Everyone" group with full control policy but is just the same!
>
>
> Dim rst
> Dim strSQL
> Dim gdbConn
> strSQL = vbNullString
> strSQL = strSQL & "Delete from MyTable" ' etc...
> Call GetDataConnection()
> Set rst = gdbConn.Execute (strSQL)
> Set rst = Nothing
> Call CloseDataConnection()
>
> '===========================
> Function GetDataConnection()
> '===========================
> Dim strConn
>
> Set gdbConn = Nothing
> Set gdbConn = CreateObject("ADODB.Connection")
> gdbConn.Provider="Microsoft.Jet.OLEDB.4.0"
> strConn = "C:\Cancella\MyMDB.mdb"
> On Error Resume Next
> gdbConn.Open strConn
> If err.number <> 0 Then
> Msgbox err.description, vbExclamation+vbOkOnly, "Database Connection
> Error"
> End If
>
> Set GetDataConnection = gdbConn
> blnConnect = True
> End Function
>
> '========================
> Sub CloseDataConnection()
> '========================
> If Not(gdbConn Is Nothing) Then
> gdbConn.Close
> Set gdbConn = Nothing
> End If
> End Sub
When I modify MS Access tables, I use an ADODB Command object. I also
specify "Data Source=" in the connection string. I don't know if this will
help in your case. For example:
==========
' Connection string for MS Access database.
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\Cancella\MyMDB.mdb"

' Connect to MS Access database.
Set adoCommand = CreateObject("ADODB.Command")
adoCommand.ActiveConnection = strConnect

' Modify table MyTable.
adoCommand.CommandText = "DELETE FROM MyTable WHERE ..."
adoCommand.Execute
=========
Otherwise, you may lack permissions. You error message seems to indicate
this. Can you open the database in MS Access by double-clicking on the *.mdb
file? If so, can you modify the table?

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to do No hang up VBScript (nohup for VBScript) VB Script
Windows System Time and Desktop time not matching up Vista General
Changing the time zone changes the appointment time in calendar .NET General
Internet Time Synchronization Incorrect - Showing Standard Time PowerShell
Demo of getting/setting time from an RFC867 time source PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46