Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if then else error..... 1

Status
Not open for further replies.

ixian

Programmer
Jul 13, 2001
128
US
Hey all,

ok here is my code:(i get a compile error--- else without if)

If eChar <> Chr$(10) And eChar <> Chr$(13) _
And eChar <> &quot; &quot; And eChar <> &quot;:&quot; Then _
tmp2$ = tmp2$ & eChar$
Else
tmp2$ = &quot; &quot;
End If

Have I got something wrong here????


Aaron Fear is the mind killer!!!!!!
 
Remove the '_' after the Then

If eChar <> Chr$(10) And eChar <> Chr$(13) _
And eChar <> &quot; &quot; And eChar <> &quot;:&quot; Then
tmp2$ = tmp2$ & eChar$
Else
tmp2$ = &quot; &quot;
End If
 
All I did was remove the underscore after THEN and removed the dollar sign from the echar$ on final line and it worked fine for me.
Code:
Private Sub Command1_Click()
If eChar <> Chr$(10) And eChar <> Chr$(13) _
        And eChar <> &quot; &quot; And eChar <> &quot;:&quot; Then
         tmp2$ = tmp2$ & eChar
 Else
        tmp2$ = &quot; &quot;
 End If


End Sub
 
woyler,

thanks....sometimes i over use &quot;_&quot; .....


aaron Fear is the mind killer!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top