What does the field InOut store?  If it is the number checked out, you want
to increment it like:

        <cfquery datasource="ITData">
                UPDATE
                        tblApplications
                set
                        InOut = InOut + 1
                WHERE
                        appID IN (#form.appID#)
        </cfquery>

And your select for the list box could check the value of InOut agains the
number available, which I assume is another field.  If inOut is the number
available, decrement the field like:

        <cfquery datasource="ITData">
                UPDATE
                        tblApplications
                set
                        InOut = InOut - 1
                WHERE
                        appID IN (#form.appID#)
        </cfquery>

Of course, this all assumes that appID is an integer.

This works in MSSQL, but I'm not sure about other ODBC systems.

With out knowing more of the table, that's about all I can help you with.

> -----Original Message-----
> From: Jones, Becky [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 1:38 PM
> To: CF-Talk
> Subject: subtracting quantity
>
>
> i have a form for users to check out an application.  most of my
> applications are a quantity of 1, so once it is checked out, it will not
> show up in the drop down list of apps to check out until it is
> checked back
> in.  (i automatically set the checkout field to be yes).
> but for the few apps that have a quantity of greater than one, how can i
> make it so that it still shows up in the list until every single one has
> been checked out?
> right now my code just does this for every app checked out
> regardless of the
> quantity
> <cfloop list="#form.appID#" index="a" delimiters=",">
>       <cfquery datasource="ITData">
>               UPDATE
>                       tblApplications
>               set
>                       InOut = 1
>               WHERE
>                       appID = (#a#)
>       </cfquery>
>       </cfloop>
>
>
> *************************************************
> This e-mail, including any attachments, is intended for the
> receipt and use by the intended addressee(s), and may contain
> confidential and privileged information.  If you are not an intended
> recipient of this e-mail, you are hereby notified that any unauthorized
> use or distribution of this e-mail is strictly prohibited.
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to