Posts tagged access

ADODB query from linked table with conditions

I spent (too many) hours today trying to figure out why I couldn’t get a query to run through ADODB from an HTA I’m working on.  The query pulls from a linked table which links to a tab-delimited text file, and the query had a WHERE condition as such: WHERE field1 LIKE “00*” Apparently, I [...]

Run MS Access Macro with Javascript in HTA

Combined examples from this site and that site to make the following: var oAccess = new ActiveXObject(‘Access.Application’); oAccess.Visible = false; oAccess.OpenCurrentDatabase(‘c:\\path\\database.mdb’); oAccess.DoCmd.RunMacro(‘NameOfMacro’); oAccess.Quit(2); //2 = acQuitSaveNone option for save command oAccess = null;

Populate Array with Database record

Once you connect to your database (Access), you can iterate through the fields (not records!) and assign their value to an array, naming the key after the original field name. This creates an effective name/value pair that is accessible even after the database connection has been closed. Javascript example: var data = new Array(); for [...]

Line breaks in textarea from Access

To retain linebreaks in textarea from an MS Access database,  replace linefeeds with carriage return/linefeed pair and then save the input. Javascript example: strInput.replace(/\n/g, ‘%0D%0A’) This replaces all linefeeds (line breaks) in the strInput (using “/\n/g”) with %0D%A which signal end of data (same as a carriage return and linefeed). The original input from the [...]