Else without if


Hello everybody, i'm starting in vb can you help me? i cant find this newb error :/ it returns that 'Else without if'

strSQL = ""
strSQL = strSQL & "SELECT idProcessadorNF "
strSQL = strSQL & "FROM tbComputadores"
strSQL = strSQL & "WHERE idComputador = " & vrtIdComputador <> 0

'Call subEfetuaConexao
Set rstAux = New ADODB.Recordset
rstAux.Open strSQL
If Not rstAux.EOF And Not IsNull(rstAux.Fields.Item("vrtIdProcessadorNF").Value) Then
vrtIdProcessadorNF = IIf(IsNull(rstAux.Fields.Item("vrtIdProcessadorNF").Value), 0, rstAux.Fields.Item("vrtidProcessadorNF").Value)
End If

Else
vrtIdProcessadorNF = 0
End If
rstAux.Close

End Sub

If you enjoyed this post, subscribe for updates (it's free)

-----------------------------

---------------------------------------
Call subEfetuaConexao
Set rstAux = New ADODB.Recordset
rstAux.Open strSQL
If Not rstAux.EOF And Not IsNull(rstAux.Fields.Item("vrtIdProcessadorNF").Value) Then
vrtIdProcessadorNF = IIf(IsNull(rstAux.Fields.Item("vrtIdProcessadorNF").Value), 0, rstAux.Fields.Item("vrtidProcessadorNF").Value)
End If

Else
vrtIdProcessadorNF = 0
End If
rstAux.Close

End Sub
-------------------------------------
end if only use when end of if statement

the format should be
if (condition) then
code
else
code
end if
*without else if

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.