All,
I am having extreme trouble. I have to build a graphical system to quickly determine the status of a vehicle fleet. I have a table with the Vehicle Id and a yes no for status. I am querying the table and returning these two items. My problem is the code only works for the first record and none of the following records. I have tried for statements and added a incremental field, but to no avail.
My idea was to have a form with multiple command buttons (i.e. 40 of them) and on click opens an additional form where you can adjust the properties of that vehicle. That portion works. The code is in form on open where it would change the caption from red - in service=false (i.e. out of service) and blue - in service = true (i.e. usable) So that way you could look and quickly tell which vehicles were not usable. Here is the code for the form on open:
<code>
If [Vehicle Number] = "e1016" And [In Service] = True Then
Command2.ForeColor = vbBlue
Else
Command2.ForeColor = vbRed
End If
</code>
This works since "e1016" is the first record but if it were "f4567" it doesn't because "f4567" is the 10th record. Any ideas on how to make this work?
I am having extreme trouble. I have to build a graphical system to quickly determine the status of a vehicle fleet. I have a table with the Vehicle Id and a yes no for status. I am querying the table and returning these two items. My problem is the code only works for the first record and none of the following records. I have tried for statements and added a incremental field, but to no avail.
My idea was to have a form with multiple command buttons (i.e. 40 of them) and on click opens an additional form where you can adjust the properties of that vehicle. That portion works. The code is in form on open where it would change the caption from red - in service=false (i.e. out of service) and blue - in service = true (i.e. usable) So that way you could look and quickly tell which vehicles were not usable. Here is the code for the form on open:
<code>
If [Vehicle Number] = "e1016" And [In Service] = True Then
Command2.ForeColor = vbBlue
Else
Command2.ForeColor = vbRed
End If
</code>
This works since "e1016" is the first record but if it were "f4567" it doesn't because "f4567" is the 10th record. Any ideas on how to make this work?