Hufo1910 Posted September 23, 2015 Share Posted September 23, 2015 Hey everybody,i try to use the AutoIT Access.au3 & Example_Access.au3 => (https://www.autoitscript.com/forum/topic/140277-ms-access-udf/) conected with Access 2013 DB (64bit, W10).Most _funcs work as they should, but I dont know how to send querys to Access.At the moment i know how to show data by usingFunc Example_AccessSelectQueryFetch () Local $o_DataBase = _AccessOpen(@ScriptDir & "\Test.mdb") Local $h_Query, $aRow [1] If $o_DataBase = 0 Then MsgBox(0, "Information", "Database file is not found :-" & @CR & @ScriptDir & "\Test.mdb") Return EndIf ;Local $feedback =_AccessSelectQuery ($o_DataBase, "Select * From tblTable1 where fld1=3" ) Local $feedback =_AccessSelectQuery ($o_DataBase, "Select * From tblTable1", $h_Query ) ; <<====== if $feedback = 0 Then MsgBox (0,0, _AccessErrCode() & " " & _AccessErrMsg ()) _AccessClose($o_DataBase) Return EndIf while _AccessFetchData ( $h_Query, $aRow) = 1 _ArrayDisplay ($aRow) If _AccessRecordMove($h_Query, 1) = 0 Then ExitLoop WEnd MsgBox (0,"Info", "All Rec. in Query is read" & @LF & _AccessErrCode() & " " & _AccessErrMsg () ) _AccessClose($o_DataBase) EndFuncI would like to replace "Select * From tblTable1" by something likeSELECT fld1 FROM tblTable1WHERE fld2 = 99 ; (<== works in Access SQL)If i do it like thisLocal $feedback =_AccessSelectQuery ($o_DataBase, "SELECT fld1 FROM tblTable1 WHERE fld2 = 99", $h_Query)it doesnt work.Does anybody know what i am doing wrong ?Is_AccessSelectQueryFetchthe correct _func for using a sort / filter function or isFunc Example_AccessActionQuery() Local $o_DataBase = _AccessOpen(@ScriptDir & "\Test.mdb") Local $h_Query If $o_DataBase = 0 Then MsgBox(0, "Information", "Database file is not found :-" & @CR & @ScriptDir & "\Test.mdb") Return EndIf Local $feedback =_AccessActionQuery ($o_DataBase, "INSERT INTO tblTable1 ( fld1, fld2 ) values ('Try add rec', 5)" ) if $feedback = 0 Then MsgBox (0,0, _AccessErrCode() & " " & _AccessErrMsg ()) Else MsgBox (16,"Info", "Done without Errors") EndIf _AccessClose($o_DataBase) EndFuncthe better choice (or maybe anything else) ?Maybe there is only a syntax mistake or the .udf doesnt work with Access 2013 at all ?Thanks for your support: Hufo Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now