You probably have a null value coming through...put in an or statement ...or qryHighestNum.highestNumber is ""... So that if it is a null value or no value...it is set to 1
If you want to see where your problem is do a cfdump (<cfdump var="#qryHighestNum#">) that will display your query results. Eric -----Original Message----- From: Melissa Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, 30 January 2007 14:30 To: CF-Talk Subject: CFset problem I've very new to ColdFusion and need some help. I've written a page that has six fields: office, year, number, title, contact and phone number. The first two are hidden fields have a value attached to them and the third changes. The user enters the title, contact and phone number and then the data is entered into a database. The two hidden fields are populated with no problems. For the third field, number, a query is ran to find the highest number in that field and then add one to it to get the next number. When an initial record is in the database everything works perfect however, when the table is empty I get an error message. It says that it cannot convert " " to a number. I even put a cfset statement in there to set the field to 1 but it isn't working. Any ideas? Below is the query to find the highest number and the cfif statement to handle the number. <cfquery name="qryHighestNum" datasource="ocreodsn"> Select Max(ReqNum) as HighestNumber from PrintingReq </cfquery> <cfif qryHighestNum.RecordCount is 0> <cfset NextReqNumber = 1> <cfelse> <cfset NextReqNumber = #qryHighestNum.HighestNumber# + 1> </cfif> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268169 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4