Jump to content

Trouble connecting to Microsoft Access


Suxor
 Share

Recommended Posts

Hey Smarty Pants,

I am having trouble figuring out how to connect to MS Access 2007. I am on Vista and I wouldnt be suprized if it is related to some lame security setting or something...

I have read up quite a bit and have even checked out some of the UDF for access posted on these forums.

I have tried several things and no matter what i do i ALWAYS get this error :

"

Line-1:

Error: The requested action with this object has failed.

:

Below is the code I am using, any suggestions?

Global $ODBC_Access="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Sheepzor.accdb"
$newCon = ObjCreate ("ADODB.Connection")
$newCon.Open ($ODBC_Access & ";")

$rs = $newCon.Execute("SELECT * FROM Sheep_Play")
while not $rs.EOF
$name = $rs.fieldS("AutoitCommand").value

MsgBox(0,"testing",$name)

$rs.MoveNext
wend
$rs.Close
$rs = ""
Link to comment
Share on other sites

Ok...

Well I havent resolved the issue yet but i know that the problem is with this line of code:

Global $ODBC_Access="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Sheepzor.accdb"

Is there something I am missing? Do need to create an actual ODBC for every access database even if they arent password protected? Is there a security setting in MS Access 2007 or in Vista that i have enable?

What the heck am i doing wrong?

Thanks in advance, this is really annoying me. I have been googleing like mad trying to find answers.

Link to comment
Share on other sites

so i think i have identified that it is an ms access 2007 thing... because i was able to connect to ms access 2003 using the following code ;)

$adoCon.Open ("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbname)

Still I would rather use ms access 2007. Any ideas from you guys who have it working on 2007?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...