Run Update Query on exit from DIW form

G

Guest

I am running Access2003 and FP2003. I have created a Database Interface using
the Wizard. OK so far, all works fine. I have an update query in the Access
database that takes the value of one data entry field (euros) and after
calculation, puts a value in the second field (pounds). This I do manually by
running the update query after the record is entered into the database. What
I want to do is run the update query automatically so when the record is
entered (using the DIW new.asp) into the database, by adding some SQL to the
new.asp in the database wizard file it performs the update then.

Something like

'Perform Prices update
StrSQL = "UPDATE table1, table1.PricePounds = [PriceEuros]/[1.45] WHERE
(((table1.Autoconverton)=Yes));"
fp_conn.Execute StrSQL

(1.45 is the current rate of conversion, and table1.autoconveton is a field
that allows the convert to take place if value "Yes") The update query in the
Access database runs ok.
Many thanks
Mick
 
S

Stefan B Rusynko

No need to do an update at all
in the top of your page add a conversion variable (so you can easily change it later)
<% Rate=1.45 %>

In your DIW edit page just add the form field for PricePounds with a value of:
<input type="hidden" name="PricePounds" value="<% =PriceEuros/Rate%>">

you may need to reference PriceEuros above using the DBIW field ref of something like
fp_rs("PriceEuros")

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|I am running Access2003 and FP2003. I have created a Database Interface using
| the Wizard. OK so far, all works fine. I have an update query in the Access
| database that takes the value of one data entry field (euros) and after
| calculation, puts a value in the second field (pounds). This I do manually by
| running the update query after the record is entered into the database. What
| I want to do is run the update query automatically so when the record is
| entered (using the DIW new.asp) into the database, by adding some SQL to the
| new.asp in the database wizard file it performs the update then.
|
| Something like
|
| 'Perform Prices update
| StrSQL = "UPDATE table1, table1.PricePounds = [PriceEuros]/[1.45] WHERE
| (((table1.Autoconverton)=Yes));"
| fp_conn.Execute StrSQL
|
| (1.45 is the current rate of conversion, and table1.autoconveton is a field
| that allows the convert to take place if value "Yes") The update query in the
| Access database runs ok.
| Many thanks
| Mick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top