Jump to content

MSAccess UDF [updated]


GEOSoft
 Share

Recommended Posts

I will have to look it up. That, for some reason is something that I did not consider. I'll see what I can do to add the function. Thanks for getting back to me so quickly.

Hey Geosoft,

After some tinkering and blind guesses I got this code to work in your _dbOpen funtion:

$oADO.Provider = $adoProvider & "Jet OLEDB:Database Password=password"

Adding that second part seems to have done it. Hope that helps!

Link to comment
Share on other sites

  • 4 weeks later...

I have not uploaded the example code yet. There are a couple of examples in this thread and (I think) a couple on the UDF itself. What are you trying to do? If you tell me that, I can probably work out an example for you.

_accessAddRecord

$rData - Data to be added to field (to add data to multiple fields this must be an array) see notes

In the udf it says see notes I can't find the notes.

-Bryon

Link to comment
Share on other sites

_accessAddRecord

$rData - Data to be added to field (to add data to multiple fields this must be an array) see notes

In the udf it says see notes I can't find the notes.

-Bryon

Ignore it. I forgot to update the function header after I modified the function. You can actually pass it a pipe delimited list too (item1|item2||item4).

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Ignore it. I forgot to update the function header after I modified the function. You can actually pass it a pipe delimited list too (item1|item2||item4).

Is there away to say this data into this field? ie like the vbs scripts?

FileWriteLine($file, 'rsAddInfo.Fields("colum1") = ' & '"' & inputdata & '"')

-Bryon

Link to comment
Share on other sites

  • 2 weeks later...

Runing winXP SP3, MS Access 2007, file is .mdb (access 2002-2003 file format).

I'm having an error opening the database file, when using this UDF:

(689) : ==> The requested action with this object has failed.:
$oADO.Open($adSource)
$oADO.Open($adSource)^ ERROR

After hours of trying and googling and searching this forum, I'm still not able to figure this out:

maybe this udf is not working with access 2007?

whats up with Microsoft.Jet.OLEDB.4.0 and access 2007? I found the corresponding dlls in my system32 folder, which were listed on microsoft's support page, even registered them manualy, nothing works... :mellow:

Please help, because I'm kinda new to all this SQL and connections business, was using {Microsoft Access Driver (*.mdb)} as provider before in a couple of my scripts, but this looks way more easier to use.

Thanks in advance.

Link to comment
Share on other sites

Runing winXP SP3, MS Access 2007, file is .mdb (access 2002-2003 file format).

I'm having an error opening the database file, when using this UDF:

(689) : ==> The requested action with this object has failed.:
$oADO.Open($adSource)
$oADO.Open($adSource)^ ERROR

After hours of trying and googling and searching this forum, I'm still not able to figure this out:

maybe this udf is not working with access 2007?

whats up with Microsoft.Jet.OLEDB.4.0 and access 2007? I found the corresponding dlls in my system32 folder, which were listed on microsoft's support page, even registered them manualy, nothing works... :mellow:

Please help, because I'm kinda new to all this SQL and connections business, was using {Microsoft Access Driver (*.mdb)} as provider before in a couple of my scripts, but this looks way more easier to use.

Thanks in advance.

Sounds like one of two things, Invalid path to the database is most likely or the database is already open. How are you calling it in your script?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Sounds like one of two things, Invalid path to the database is most likely or the database is already open. How are you calling it in your script?

Thank you so much for a fast answer. It seems my problem was in the invalid path. After you pointing it out, I did more tests and it seems, the problem was "=" in my path. One of the folders had it in its name. And I spent hours going crazy :mellow: Thanks again.

Link to comment
Share on other sites

It's not there now.

It was when I looked a few minutes ago. It's in the zip file, not in the code display.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

It was when I looked a few minutes ago. It's in the zip file, not in the code display.

Thanks for your confirmation that the AccessConstants.au3 file is on your site.

I found where it is supposed to be, but it is not accessible / viewable on my computer.

Here is a screen shot of what I get when All Downloads is clicked and double clicked.

And I can not find any zip files anywhere on this site.

I also noticed under the Code menu , Full Source, Code Examples, and Tips and Tricks, are not working for me.

I am thinking it may be an obscure setting on my system needs to be enabled, or the short comings of my ISP, or a government censorship. I don't know.

This is just a heads up about the possibility that not every one can access all of your site. And, an attempt to dispel any thoughts that I am a complete, blithering idiot.

I have really spent too much time on this, which started as a casual, "What's this about. GEOSoft knows stuff. Could be useful."

If I hadn't been able to download Access.au3, I would have given up immediately.

Link to comment
Share on other sites

Thanks for your confirmation that the AccessConstants.au3 file is on your site.

I found where it is supposed to be, but it is not accessible / viewable on my computer.

Here is a screen shot of what I get when All Downloads is clicked and double clicked.

And I can not find any zip files anywhere on this site.

I also noticed under the Code menu , Full Source, Code Examples, and Tips and Tricks, are not working for me.

I am thinking it may be an obscure setting on my system needs to be enabled, or the short comings of my ISP, or a government censorship. I don't know.

This is just a heads up about the possibility that not every one can access all of your site. And, an attempt to dispel any thoughts that I am a complete, blithering idiot.

I have really spent too much time on this, which started as a casual, "What's this about. GEOSoft knows stuff. Could be useful."

If I hadn't been able to download Access.au3, I would have given up immediately.

I see you also missed the part on the main page that says "This is a totally new page so don't be surprised if you find dead links". The content for some of those links has not been uploaded yet. For the Access zip file, go to the right menu, click Code>>My Extra UDFs>>Access.au3. That opens to the text version. At the bottom you will find the Download button. If you still have a problem, post back and I'll give you a direct download link.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

My second question is about adding data to multiple fields in a single record. I gathered from your code that it's something like

$rData="Data1|Data2|Data3"
but that gives me the following error:

C:\Program Files\Life Action\ADO.au3 (285) : ==> The requested action with this object has failed.: 
.Fields.Item($I -1) = $rData[$I] 
.Fields.Item($I -1) = $rData[$I]^ ERROR
->18:22:01 AutoIT3.exe ended.rc:1
Hello,

I just came across these UDFs, download its latest version and I'm quite impressed. However, I have the exact same problem as described in the quote, but this even happens with non-arrays. I'm using Microsoft Access 2007 along with Autoit v3.2.12.1. I'm quite new to Access and to avoid compatibility issues, I decided to create a database of an older version (MS Access 2003? Not sure), so it has the ending .mdb., added a table "Cars" along with some filled fields and some empty fields.

I was able to update a record with _accessUpdateRecord but adding a record did not work at all, I don't know what I did wrong. I used this in my code:

_accessAddRecord("C:\Program Files\testdata\test.mdb", "Cars", "Porsche", 2)

Then I tried with a simple array:

_accessAddRecord("C:\Program Files\testdata\test.mdb", "Cars", "Porsche|Ferrari")

but still getting the same error message as in the quotes. What did I do wrong?

Edited by Automania

Using AutoIt v3.3.14.5 Accelerate medical research with your PC

Link to comment
Share on other sites

Hello,

I just came across these UDFs, download its latest version and I'm quite impressed. However, I have the exact same problem as described in the quote, but this even happens with non-arrays. I'm using Microsoft Access 2007 along with Autoit v3.2.12.1. I'm quite new to Access and to avoid compatibility issues, I decided to create a database of an older version (MS Access 2003? Not sure), so it has the ending .mdb., added a table "Cars" along with some filled fields and some empty fields.

I was able to update a record with _accessUpdateRecord but adding a record did not work at all, I don't know what I did wrong. I used this in my code:

_accessAddRecord("C:\Program Files\testdata\test.mdb", "Cars", "Porsche", 2)

Then I tried with a simple array:

_accessAddRecord("C:\Program Files\testdata\test.mdb", "Cars", "Porsche|Ferrari")

but still getting the same error message as in the quotes. What did I do wrong?

I'm going to take another look at that function sometime today. I changed it quite a while back and may have broken something in the process.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I'm going to take another look at that function sometime today. I changed it quite a while back and may have broken something in the process.

Thank you. :mellow: Looking forward to your solution.

In the meantime, I have a question regarding updating a record. The update function is

_accessUpdateRecord($adSource,$adTable,$adCol,$adQuery,$adcCol,$adData)

and the notes say

$adQuery - the string to find

Is it mandatory to provide a string to find? How can I update a record whose content changed and the script won't know what the string is? Is there a way to just update the record by just telling the function to overwrite the content in a specific field or do I have to read the data from the record first to be able to update it?

Using AutoIt v3.3.14.5 Accelerate medical research with your PC

Link to comment
Share on other sites

Thank you. :mellow: Looking forward to your solution.

In the meantime, I have a question regarding updating a record. The update function is

_accessUpdateRecord($adSource,$adTable,$adCol,$adQuery,$adcCol,$adData)

and the notes say

$adQuery - the string to find

Is it mandatory to provide a string to find? How can I update a record whose content changed and the script won't know what the string is? Is there a way to just update the record by just telling the function to overwrite the content in a specific field or do I have to read the data from the record first to be able to update it?

That actually finds the record(s) that matches the criteria so it knows which record(s) to update. Not to be confused with the field (column). It is a required field but if I recall correctly it will take an empty string. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

That actually finds the record(s) that matches the criteria so it knows which record(s) to update. Not to be confused with the field (column). It is a required field but if I recall correctly it will take an empty string.

Just tried it out, apparently it is mandatory. I used the following code:

_accessUpdateRecord("C:\Program Files\Testdb\test456.mdb", "Cars", "Field1", "", 1, "Porsche")

That produces the following error:

==> The requested action with this object has failed.:

$oRec($adcCol) = $adData

$oRec($adcCol) = $adData^ ERROR

This also happens if I provide a string to search for but it does not match the content of the field located in the first record field of column "Field1".

If you need more information, let me know.

Any news yet what's wrong with adding a record? :mellow:

Edited by Automania

Using AutoIt v3.3.14.5 Accelerate medical research with your PC

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I am having some problem with your fist example.

#include<mysql.au3>

$sql = _MySQLConnect("root","","db","localhost")
$var = _Query($sql,"SELECT * FROM mytable WHERE user = 'username'")
With $var
While NOT .EOF
FileWriteLine("c:\test.txt",.Fields("user_name").value & @CRLF)
.MoveNext
WEnd
EndWith
_MySQLEnd($sql)

I am trying to run the script with a sql db from xampp(localhost). The data base is called db, user is root, no password.

The script is returning the following error : C:\Program Files\AutoIt3\Include\mysql.au3 (48) : ==> The requested action with this object has failed.:

Can you help me with this? Thanks

Link to comment
Share on other sites

Hi, I am having some problem with your fist example.

#include<mysql.au3>

$sql = _MySQLConnect("root","","db","localhost")
$var = _Query($sql,"SELECT * FROM mytable WHERE user = 'username'")
With $var
While NOT .EOF
FileWriteLine("c:\test.txt",.Fields("user_name").value & @CRLF)
.MoveNext
WEnd
EndWith
_MySQLEnd($sql)

I am trying to run the script with a sql db from xampp(localhost). The data base is called db, user is root, no password.

The script is returning the following error : C:\Program Files\AutoIt3\Include\mysql.au3 (48) : ==> The requested action with this object has failed.:

Can you help me with this? Thanks

You are in the wrong thread. You want the SQL thread. I think this is it

http://www.autoitscript.com/forum/index.php?showtopic=17099

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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...