Query data in Microsoft Access and input into web from

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Trevor Hughes
Junior Coder
Posts: 25
Joined: Sun Dec 15, 2013 9:27 pm

Query data in Microsoft Access and input into web from

Post by Trevor Hughes » Sun Dec 15, 2013 10:03 pm

I would like to use Macro Scheduler to query data in an Access database and input this data into a Web site.

There are examples of how to connect to a databse but I cannot locate anything that shows how to loop throgh the records and take the data from the query and send it to text fields on the web page.

If anyone could provide a script which does this I would be able to modify it to suit my needs.

Any help would be greatly appreceiated.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Dec 15, 2013 10:09 pm

Hi,

DBQuery returns an array. You would then loop through that array - usually using a Repeat/Until loop.

http://www.mjtnet.com/blog/2008/04/15/u ... functions/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Trevor Hughes
Junior Coder
Posts: 25
Joined: Sun Dec 15, 2013 9:27 pm

Post by Trevor Hughes » Sun Dec 15, 2013 10:20 pm

Hi thanks for the reply. Below is the connection and SQL I wish to use:
DBConnect>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\CusMod Testing\Goods Testing.mdb;Persist Security Info=False,GoodsTesting
DBQuery>GoodsTesting,Select * From tblEntryHeader,rset,NumRecs,NumFields,0

Assuming that I have fields called "FileName" and "ReferenceID" being returned by my SQL and I want to input these into a field on the web page, could you show me an example of how the repeat statement would work?

Trevor Hughes
Junior Coder
Posts: 25
Joined: Sun Dec 15, 2013 9:27 pm

Problem solved - Query data in Microsoft Access and input

Post by Trevor Hughes » Mon Dec 16, 2013 3:04 am

I have managed to solve my problem.

The code is shown below:

CODE STARTS
----------------

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
DBConnect>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\CusMod Testing\Goods Testing.mdb;Persist Security Info=False,GoodsTesting
DBQuery>GoodsTesting,Select * From tblEntryHeader,rset,NumRecs,NumFields,0

//loop through returned recordset
Let>r=0
RunProgram>Notepad
Repeat>r
Let>r=r+1
Let>EntryNum=RSET_%r%_11
Let>ClientRef=RSET_%r%_32
SendText>ClientRef
SendText>,
SendText>EntryNum
Press Enter
Wait>0.5
Until>r=numrecs

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Dec 16, 2013 2:12 pm

Yup, like that.

To send into the website I would use the IE... functions.

You could record putting static data into the form using WebRecorder, then use that code and replace the static text with the data from your query.

Or if you want to use keystrokes you probably just need to add more to "tab" around the form. You could also use image recognition to navigate the page.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts