Hi @mush ,
First your if stamtemnt can be abbreviated as:
If lbllvl1.Text = "HOS" Then
StatFlag = 47
Label1.Text = "hello world"
ElseIf lbllvl2.Text = "HOD" Then
StatFlag = 46
Label1.Text = "not hello world"
ElseIf lbllvl3.Text = "ADAA" Then
StatFlag = 41
Label1.Text = "hello world"
ElseIf lbllvl4.Text = "HR" Then
StatFlag = 46
Label1.Text = "hello world"
End If
Secondly, if you write an if statement based on your database, it will be troublesome.
My suggestion is that each level is fixed. For example, if the first layer is HOS, it will always be HOS, and if it does not exist, it will be 0;
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.