|
-
Jun 13th, 2010, 02:23 PM
#1
Thread Starter
New Member
Newbie
Hi
I am new to VB scritping and having problems with the IF then statements ... I know basic stuff :-)
I want to validate a screen... I have a pull downlist and if a user choses an option I want to check that data is valid but I don't seem to be getting it right
i.e. If a person chooses a value of SMS I want to ensure a mobile number has been entered on the page
If a person selects Fax I want to ensure that a fax number has been entered on the page
If Post then address and if Phone then a phione number has been entered
and for all if they don't I want to show an error message .... this is causing me to go grey ... LOL...please advise on the best way to do this ... Thanks in advanced
Cheers
-
Jun 13th, 2010, 03:41 PM
#2
Re: Newbie
When you say VB scripting are you using VB.Net or one of the scripting variants like VBA?
-
Jun 13th, 2010, 03:46 PM
#3
Re: Newbie
It's best to use a Select Case statement for something like this. Also, VB.NET is not scripting. It's a real programming language. It's not VB Script.
vb Code:
Select Case ComboBox1.SelectedIndex Case 0 'Do work for first selected item Case 1 Case 2 Case 3 End Case
*Edit: Err... keystone_paul was quicker than me. I guess it does matter whether or not you've screwed up your vernacular or you really are using something like VB Script or VBA.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Jun 13th, 2010, 04:07 PM
#4
Thread Starter
New Member
Re: Newbie
I am using a VBA variant I tried
If "aObjects("LP1030Commsmethod")" = "SMS" Then
If "aObjects("LP10170Mobilenumber")" = "avar1" then
fcTrigger = "ERR: Please provide a mobile number if SMS is the prefered method of communications"
Else
fcTrigger = "ERR: Else Triggered"
End If
End If
And this doesn't seem to output the error message
-
Jun 13th, 2010, 04:32 PM
#5
Re: Newbie
That wouldn't output anything if the first IF statement was false, therefore, that seems likely.
My usual boring signature: Nothing
 
-
Jun 13th, 2010, 04:32 PM
#6
Re: Newbie
But are you coding in VB.NET?
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Jun 13th, 2010, 04:35 PM
#7
Re: Newbie
I think we can assume that the answer is NO, but it doesn't really matter.
I just noticed the quotation marks around: "aObjects("LP1030Commsmethod")"
You may be expecting aObjects to be an object with a property, or some such, but by enclosing it in quotes, it becomes nothing more than a string litteral. aObjects isn't evaluated at all, it's just a string, which can't possibly equal the string "SMS", because it is the string "aObjects("LP1030Commsmethod")"
Remove the quotation marks around that aObjects part in both of the If statements.
My usual boring signature: Nothing
 
-
Jun 13th, 2010, 04:41 PM
#8
Re: Newbie
I think we can assume that the answer is NO, but it doesn't really matter.
It matters because then this question doesn't belong in this section of the forum. But I was asking if he was because he said he was trying a variant of VBA. Which lead me to think he was trying to use VBA in VB.NET.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Jun 14th, 2010, 06:15 AM
#9
Re: Newbie
Moved To Office Development
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|