Jump to content

Access UDF Error


Herb191
 Share

Recommended Posts

This code works fine on my computer running XP with Access 2007 yet when I run it on a computer with windows 7 and Access 2007 I get an error. Any suggestions? Thanks.

#include <Access.au3>
Global $adSource = @ScriptDir & "\test.mdb"
$Number_of_records = _accessCountRecords($adSource, "accounts")

Error:

The requested action with this object has failed.:

$oADO.Open ($adSource)

$oADO.Open ($adSource)^ ERROR

Link to comment
Share on other sites

You did like many others before you and didn't read. You are missing the constants file; download the zip file and place both files it contains in the autoit3/include/ folder.

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

What version of Access are you using?

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 probably has to do with the version. I'll look into it and get back to you.

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

Open the access.au3 file and look at line 212.

Comment out that line and add this line below it.

If $oRec.recordcount <> 0 Then $oRec.MoveLast

See if it helps.

Also make sure the file is correct.

I also just noticed that the site copy doesn't have the error handler in it. I'll have to take a look and see where I put that version.

It shouldn't be a provider issue since I have already taken care of that in the constants file; 2010 may be an issue but not 2007.

BTW that UDF is no longer supported but I will look at reasonable changes.

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

Ok I double checked to make sure the file was correct and added your code and this is what I got:

>Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3

C:\Program Files (x86)\AutoIt3\Include\Access.au3(213,24) : WARNING: $oRec: possibly used before declaration.

If $oRec.recordcount <>

~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Cassini\Desktop\AMR tests\test5.au3 - 0 error(s), 1 warning(s)

->17:12:43 AU3Check ended.rc:1

>Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Cassini\Desktop\AMR tests\test5.au3"

C:\Program Files (x86)\AutoIt3\Include\Access.au3 (695) : ==> The requested action with this object has failed.:

$oADO.Open ($adSource)

$oADO.Open ($adSource)^ ERROR

->17:12:44 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 2.871

BTW that UDF is no longer supported but I will look at reasonable changes.

Thank you for taking your time to help me with this. This is part of a larger project I am doing for a client. I have 99 percent of the code done and was very surprised when I found out that the code using your UDF worked fine on my computer but not on the clients. I don’t know what I will do if I can’t get this working because the job requires the code to interact with Access. So once again thank you.

Also if you can point me to a copy of the UDF with an error handler in it I will see what I get.

Thanks,

Herb

Link to comment
Share on other sites

I'm still looking at the problem but the system that I have Office 2007 installed on (big mistake) is the same system that I don't have AutoIt or any other dev software installed on so I have to make the changes on one machine and then compile a test and try it on the other machine.

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

Herb191, I just realized that you said it's Windows 7 on the machine giving the problem. Check for a permissions issue. The System I'm testing on has Vista with UAC turned off and Office 2007 (still a big mistake). BTW, not only is this tying you up, it's also delaying my plan to roll that machine back to XP and install Office 2003(the last decent version IMHO).

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 tried adding #RequireAdmin to the access.au3 file. The error goes away but still stops the code at the same spot.

I did a bunch of Googling and found this post:

http://bytes.com/topic/access/answers/886682-adodb-connection-automation-error

Do you think I need to use some kind of registry redirect? It seemed to work for the guy in that post but I have no idea how to do that.

Thanks.

Edited by Herb191
Link to comment
Share on other sites

If it's 64 bit Windows I would lay money on that being the problem. I don't (and won't) use 64 bit systems and so far I've had no luck reproducing your problem for reasons previously mentioned.

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

Well unfortunately its 64 bit. I know you said you won't use 64 bit windows but if you were do you think some kind of registry redirect would work? And if so do you know how I might go about doing that or where I can find some information on doing that. Thanks.

Link to comment
Share on other sites

Other than Google I have no idea. I've never had a use for redirects and hope I never will. With any luck someone else will jump in but since the problem is probably pinned down you might want to start a thread about registry redirects.

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

Why not use for now >>

#AutoIt3Wrapper_UseX64=N

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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