CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Running Access queries in ASP

Print topic Send  topic

Author Message
DeanCovey


Posts: 22
Posted: 02/24/2007, 7:44 AM

I have seen several post regarding running Access queries from CodeCharge. This is simple. You can run update and delete queries.

First of all, create your query in Access like normal. If you are going to limit the records to be updated, then go ahead and create a generic prompt on the field you want to filter on. I use the field name in my prompt so . This will be important in ASP.

This example, a query named DedPost_Global, has multiple fields being filtered, but only one prompt, Which Header:

UPDATE PayrollDetail SET PayrollDetail.Ext = DLookUp("[Calc]","DedCalc_Global","[PayID] =" & [PayID])
WHERE (((PayrollDetail.PayHeaderID)=[Which Header]) AND ((PayrollDetail.PayFldType)<>"Income") AND ((PayrollDetail.OverrideCalc)<>-1));


To execute this query on some event,

Dim tSQL
tSQL="DedPost_Global '" & CCGetParam("HeaderID",-1) & "'"
dbconnection.Execute(tSQL)

To connect the name of the query and your parameter(s) be sure to add ' around each parameter. The parameters must be in the exact order as they come up when you manually open the query in Access. 8-)


;-)
Additional Notes: I have also tried putting this string directly into the execute function instead of using a variable. I could not get that to work. Most functions in Access seem to work. I have not tried the nz() function for example. Also I have not tried custom functions in Access either. I hope to get time to try soon. I'll probably add to this article.



Hope this helps others.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.