Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-11-2007, 02:43 PM
bradjerome bradjerome is offline
Junior Member
 
Join Date: Oct 2007
Posts: 1
bradjerome is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Arrow Elseif Problem

Function never gets past the condition in the first elseif. Wont test for one empty and one 0 unless I put those conditions in the initial if or elseif. Any suggestions????

Function form1_OnSubmit()

form1_OnSubmit = False
Set theForm = Document.form1

If Len(Trim(theForm.MACONHAND.Value)) = 0 and Len(Trim(theForm.WINONHAND.Value)) = 0 Then
MsgBox "You must enter a valid quantity for the batch.", vbCritical, "Need Input"
elseif Trim(theForm.MACONHAND.Value) < 1 and Trim(theForm.WINONHAND.Value) < 1 Then MsgBox "You must enter a valid quantity for the batch.", vbCritical, "Need Input"
elseif Trim(theForm.MACONHAND.Value) < 1 and Len(Trim(theForm.WINONHAND.Value)) = 0 Then MsgBox "You must enter a valid quantity for the batch.", vbCritical, "Need Input"
elseif Len(Trim(theForm.MACONHAND.Value)) = 0 and Trim(theForm.WINONHAND.Value) < 1 Then MsgBox "You must enter a valid quantity for the batch.", vbCritical, "Need Input"
else
form1_OnSubmit = True
End If

End Function
Reply With Quote

This ad is part of our Revenue Sharing program
  #2 (permalink)  
Old 10-11-2007, 06:19 PM
ALL's Avatar
ALL ALL is offline
Senior Member
 
Join Date: Oct 2006
Location: Sturgis, SD
Posts: 145
ALL is on a distinguished road
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default

from what i gather, "theForm.WINONHAND.Value" is a string, but you are comparing it as if it is a string and a numeric type, you should never do this, especially in VB because it hates when you do it.

right here: "Len(Trim(theForm.MACONHAND.Value))" you are acting like it's a string, but right here "Trim(theForm.MACONHAND.Value) < 1" you are acting like it's a numerical type, which makes no sense, you probably want to shell it in a Len() function.

unless you zip the project and upload it there is not muche else i can do,
-ALL
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

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



All times are GMT. The time now is 02:45 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30