where the else if not len=11

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

where the else if not len=11

Post by sal21 »

logical .....

where the else if len not=11????


If Len(RA) = 11 Then
DoEvents
RSS.Seek "=", RA

If RSS.NoMatch Then
SETT = ""
NDG_TIT = ""
CHECK_SETT = False
Else
If Not IsNull(RSS.Fields(0).Value) Then
If Not IsNull(RSS.Fields(7).Value) Then
SETT = RSS.Fields(7).Value
End If
NDG_TIT = RSS.Fields(0).Value
CHECK_SETT = True
End If
End If
End If

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: where the else if not len=11

Post by HansV »

If you indent the code systematically, it is easier to see which End If corresponds to which If.
In the code below, I have applied consistent indentation, and added comments that show what each End If belongs to.

Code: Select all

    If Len(RA) = 11 Then
        DoEvents
        RSS.Seek "=", RA
        If RSS.NoMatch Then
            SETT = ""
            NDG_TIT = ""
            CHECK_SETT = False
        Else
            If Not IsNull(RSS.Fields(0).Value) Then
                If Not IsNull(RSS.Fields(7).Value) Then
                    SETT = RSS.Fields(7).Value
                End If ' Not IsNull(RSS.Fields(7).Value)
                NDG_TIT = RSS.Fields(0).Value
                CHECK_SETT = True
            End If ' Not IsNull(RSS.Fields(0).Value)
        End If ' RSS.NoMatch
    Else
        ' Code for if Len(RA) <> 11 goes here
        ' ...
    End If ' Len(RA) = 11
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

Re: where the else if not len=11

Post by sal21 »

HansV wrote:If you indent the code systematically, it is easier to see which End If corresponds to which If.
In the code below, I have applied consistent indentation, and added comments that show what each End If belongs to.

Code: Select all

    If Len(RA) = 11 Then
        DoEvents
        RSS.Seek "=", RA
        If RSS.NoMatch Then
            SETT = ""
            NDG_TIT = ""
            CHECK_SETT = False
        Else
            If Not IsNull(RSS.Fields(0).Value) Then
                If Not IsNull(RSS.Fields(7).Value) Then
                    SETT = RSS.Fields(7).Value
                End If ' Not IsNull(RSS.Fields(7).Value)
                NDG_TIT = RSS.Fields(0).Value
                CHECK_SETT = True
            End If ' Not IsNull(RSS.Fields(0).Value)
        End If ' RSS.NoMatch
    Else
        ' Code for if Len(RA) <> 11 goes here
        ' ...
    End If ' Len(RA) = 11
tks :thankyou: for patience :grin:

but... on old my pc i can install a little tool nemad Smart Indender from OLD, now on the new pc i dont have the Admin oermissioni and i cannot install anothing!!!

exists a free tool to indent the cdoe withiut install it?

Tks as usual.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: where the else if not len=11

Post by HansV »

I don't know of any code indent add-ins that don't need to be installed. Sorry!
Best wishes,
Hans