D
Dr Gregg
Guest
I'm using VB to change the value of a Text Label on a form if a certain condition is true on the Form_Load sub.
Code:
Now say, what I want it to do is for each record change Label11.Caption to lalala if the name field is me. If it isn't, then change Label11.Caption to nonono.
As you see, it sees that in the first record the name is 'me' so it changes Label11 to lalala. However, the next name is 'him' so I want the Label to be nonono. But it sets every single Label11 the same.
Now, in this instance the first record is 'him'. The code sees this and sets Label11 to nonono. However, in the record after the name is me - so I want it to be lalala. Except again, it sets every single Label11 to the same caption as the first one was.
I don't know how to do this Conditional Statement for every record on the form.
Code:
Code:
Private Sub Form_Load()
If Me!name.Value = "me" Then
Label11.Caption = "lalala"
Else
Label11.Caption = "nonono"
End If
End Sub
Now say, what I want it to do is for each record change Label11.Caption to lalala if the name field is me. If it isn't, then change Label11.Caption to nonono.

As you see, it sees that in the first record the name is 'me' so it changes Label11 to lalala. However, the next name is 'him' so I want the Label to be nonono. But it sets every single Label11 the same.

Now, in this instance the first record is 'him'. The code sees this and sets Label11 to nonono. However, in the record after the name is me - so I want it to be lalala. Except again, it sets every single Label11 to the same caption as the first one was.
I don't know how to do this Conditional Statement for every record on the form.