If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Changing an If Statement

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-10, 09:58
ben2203 ben2203 is offline
Registered User
 
Join Date: Feb 2010
Posts: 21
Changing an If Statement

Hello All,

So I have this:

if ExpAmt = "" then
bExpAmt_missing = true
bValid = false
elseif not IsNumeric(ExpAmt) then
bExpAmt_valid = false
bValid = false
end if

if bValid then
oConn.Execute = "INSERT INTO tbl_expenses (Expense_Type, Expense_Note, Truck_id, Input_employee, Branch_id, qty, unitprice, ExpAmt, Expense_Date) " &_
"VALUES (" & Expense_Type & ", '" & Expense_Note & "', " & Truck_id &_
", " & Employee_ID & ", " & branchid & ", " & qty & ", " & Unitprice & ", " & ExpAmt & ", DATE())"

end if
end if

<td class="td_results" style="border-right: 0" colspan="5">
<%if Request.Form <> "" and not bValid then%>
<p class="red_text">Please enter a valid expense amount.</p>
<%else%>
<p>&nbsp;</p>
<%end if%>



I want to add to more controls on the form which require a numeric input, so I get the same message and results, currently the expamt works fine but need to include qty and unitprice, I was wondering if a select case statement might work?

Thanks in Advance
Reply With Quote
  #2 (permalink)  
Old 02-27-10, 23:02
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,042
Use a function.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On