Ok-
I have a form with a bunch of labels on it... The form has images that show a map of the world. The labels are for each airport... The label caption is the aiport code - SDF, ANC, HKG, CGN, etc...
Below is code that I am working with that works fine for just one record... It changes the labels coloring/properties. The color represent different stock status's for an aircraft part at an airport. I want the user to be able to look at several parts at one time. Meaning, using the form, the user can use the navigation buttons to navigate thru the records and the label changes color for each record. I'm pretty sure this can be done, I just think there needs to be a "reset" built in, and this needs to occur "between" each record when the user selects the next record. Otherwise the colors will get mixed up thru-out the form, and the user won't know the true stock status of the part/current record...
Any suggestions examples...??
Thanks in advance..!!
jw5107
Dim rstAlloc As New ADODB.Recordset
Dim ctrl As Control
Dim stLinkCriteria As String
Dim i As Integer
'Dim db As DAO.Database
'Dim rstAlloc As DAO.Recordset
'Dim qdf As DAO.QueryDef
'Dim prm As Parameter
'Set db = CurrentDb
'Set qdf = db.QueryDefs("qryWWRHistoryIID")
'For Each prm In qdf.Parameters
'prm.Value = Eval(prm.Name)
'Next prm
'Set rstAlloc = qdf.OpenRecordset(dbOpenDynaset)
rstAlloc.Open "AllocationsStatusHistory", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
stLinkCriteria = "[WWRID]= " & [WWRID] & ""
If DCount("WWRID", "[AllocationsStatusHistory]", stLinkCriteria) Then
For Each ctrl In Me.Controls
If TypeOf ctrl Is Label Then
With rstAlloc
.MoveFirst
'For i = 1 To .RecordCount
Select Case ctrl.Tag
Case Is = !Allocated
ctrl.BackStyle = 1
ctrl.ForeColor = 16711680
ctrl.FontBold = True
Case Is = !OverAllocated
ctrl.BackStyle = 1
ctrl.BackColor = 12058623
ctrl.FontBold = True
Case Is = !OnBackOrder
ctrl.BackStyle = 1
ctrl.BackColor = 8434687
ctrl.FontBold = True
Case Is = !NewAlloc
ctrl.BackStyle = 1
ctrl.BackColor = 16645064
ctrl.FontBold = True
Case Is = !DeAlloc
ctrl.BorderStyle = 1
ctrl.BorderColor = 255
ctrl.FontBold = True
ctrl.BorderWidth = 2
Case Is = !PooledGTWYs
ctrl.BackStyle = 1
ctrl.BackColor = 12582847
ctrl.FontBold = True
Case Is = !Model2kGTWYs
ctrl.BorderStyle = 1
ctrl.BorderColor = 3632896
ctrl.BorderWidth = 2
ctrl.FontBold = True
End Select
.MoveNext
'Next i
End With
End If
Next
End If
I have a form with a bunch of labels on it... The form has images that show a map of the world. The labels are for each airport... The label caption is the aiport code - SDF, ANC, HKG, CGN, etc...
Below is code that I am working with that works fine for just one record... It changes the labels coloring/properties. The color represent different stock status's for an aircraft part at an airport. I want the user to be able to look at several parts at one time. Meaning, using the form, the user can use the navigation buttons to navigate thru the records and the label changes color for each record. I'm pretty sure this can be done, I just think there needs to be a "reset" built in, and this needs to occur "between" each record when the user selects the next record. Otherwise the colors will get mixed up thru-out the form, and the user won't know the true stock status of the part/current record...
Any suggestions examples...??
Thanks in advance..!!
jw5107
Dim rstAlloc As New ADODB.Recordset
Dim ctrl As Control
Dim stLinkCriteria As String
Dim i As Integer
'Dim db As DAO.Database
'Dim rstAlloc As DAO.Recordset
'Dim qdf As DAO.QueryDef
'Dim prm As Parameter
'Set db = CurrentDb
'Set qdf = db.QueryDefs("qryWWRHistoryIID")
'For Each prm In qdf.Parameters
'prm.Value = Eval(prm.Name)
'Next prm
'Set rstAlloc = qdf.OpenRecordset(dbOpenDynaset)
rstAlloc.Open "AllocationsStatusHistory", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
stLinkCriteria = "[WWRID]= " & [WWRID] & ""
If DCount("WWRID", "[AllocationsStatusHistory]", stLinkCriteria) Then
For Each ctrl In Me.Controls
If TypeOf ctrl Is Label Then
With rstAlloc
.MoveFirst
'For i = 1 To .RecordCount
Select Case ctrl.Tag
Case Is = !Allocated
ctrl.BackStyle = 1
ctrl.ForeColor = 16711680
ctrl.FontBold = True
Case Is = !OverAllocated
ctrl.BackStyle = 1
ctrl.BackColor = 12058623
ctrl.FontBold = True
Case Is = !OnBackOrder
ctrl.BackStyle = 1
ctrl.BackColor = 8434687
ctrl.FontBold = True
Case Is = !NewAlloc
ctrl.BackStyle = 1
ctrl.BackColor = 16645064
ctrl.FontBold = True
Case Is = !DeAlloc
ctrl.BorderStyle = 1
ctrl.BorderColor = 255
ctrl.FontBold = True
ctrl.BorderWidth = 2
Case Is = !PooledGTWYs
ctrl.BackStyle = 1
ctrl.BackColor = 12582847
ctrl.FontBold = True
Case Is = !Model2kGTWYs
ctrl.BorderStyle = 1
ctrl.BorderColor = 3632896
ctrl.BorderWidth = 2
ctrl.FontBold = True
End Select
.MoveNext
'Next i
End With
End If
Next
End If