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.
Query data in Microsoft Access and input into web from
Moderators: JRL, Dorian (MJT support)
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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/
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 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?
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?
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 pm
Problem solved - Query data in Microsoft Access and input
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
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
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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.
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?