as long as the FORM contains the data needed for both actions
(INSERT
and UPDATE), you can insert/update that data into as many
tables in as
many databases as you want.
from your code & explanations it looks like you want to:
1) UPDATE a record in Table A if the form's action is update
()
2) INSERT a new record into Table B and UPDATE existing
record in Table
A if the form's action is update ()
based on the above, your form's action code should look
something like:
<!--- form's action is UPDATE --->
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_UpdateRecord") AND
FORM.MM_UpdateRecord EQ
"Issue_Frm">
<!--- just doing update --->
<cfquery datasource="Parts" username="admin"
password="dallas">
UPDATE Main_Table
SET ...
WHERE ...
</cfquery>
<cflocation url="index.cfm"><cfabort>
</cfif>
<!--- form's action is INSERT --->
<cfif IsDefined("FORM.MM_InsertRecord") AND
FORM.MM_InsertRecord EQ
"Issue_Frm">
<!--- insert record into Issues table ... --->
<cfquery datasource="Parts" username="admin"
password="dallas">
INSERT INTO Issue (Part_Number, "Date", User_Name, WAD,
Contract,
NEMS_Tag)
VALUES (...)
</cfquery>
<!--- ... AND update the Main_Table table --->
<cfquery datasource="Parts" username="admin"
password="dallas">
UPDATE Main_Table
SET ...
WHERE ...
</cfquery>
<cflocation url="index.cfm"><cfabort>
</cfif>
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/