
-----------------------------------
Anya
Sat Jun 17, 2006 6:24 pm

What am i doing Wrong??
-----------------------------------
The following is the code I have for error checking within my subprogram,

If txtName.Text = "" Then MsgBox "Name not Entered", vbOkOnly, "DAte Input Error"
    ElseIf Not IsNumeric (txtSilver.Text) Then MsgBox "Not a Number",   
    vbOkOnly, "Data Input Error"

my problem here is when I run the program im given an error message that says Else without If. and then directs me to the ElseIf statement.  I dont know whats wrong, can anyone help ???? :lol:

-----------------------------------
wtd
Sat Jun 17, 2006 6:50 pm


-----------------------------------
Use code tags, and skip to a newline after "then".

-----------------------------------
Anya
Sat Jun 17, 2006 6:54 pm


-----------------------------------
i do have a new line after then in my actual program...  and what do you mean by code tags, i thought i was

-----------------------------------
wtd
Sat Jun 17, 2006 7:01 pm


-----------------------------------
[code][/code]

-----------------------------------
GlobeTrotter
Sat Jun 17, 2006 8:27 pm


-----------------------------------
Also, it is proper formatting to use parenthesis when calling a function.  eg: instead of 

MsgBox "Hello"


use 


Call MsgBox ("Hello")


-----------------------------------
Anya
Sat Jun 17, 2006 8:46 pm


-----------------------------------
I know that but they arent necessary for it to work.. i just want it to work... i still keep getting and erroe message that saya Else without If.. and sends me back to the ElseIf ... i cant see the problem

-----------------------------------
GlobeTrotter
Sat Jun 17, 2006 9:18 pm


-----------------------------------
This should work, if not post the exact code causing the problems.


If txtName.Text = "" Then 
    Call MsgBox ("Name not Entered", vbOkOnly, "Data Input Error")
ElseIf Not IsNumeric (txtSilver.Text) Then 
    Call MsgBox ("Not a Number", vbOkOnly, "Data Input Error")
End If


-----------------------------------
cool dude
Sun Jun 18, 2006 10:38 am


-----------------------------------
i do have a new line after then in my actual program...  and what do you mean by code tags, i thought i was

thats a lie! the reason i know is because that is the exact error your getting because your not skipping a line. btw u r missing an end if at the end of your code.
