vb code in access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aman909
    New Member
    • Jun 2007
    • 20

    #1

    vb code in access

    Im trying to use some vb code in a form which simply changes font colours. It is for a stock control system. The stock control system includes three items: colour, stock and minimum stock.

    The code is:

    Private Sub Form_Current()
    If Me.Colour = "Red" And Me.Minimum_Stoc k > Me.Stock Then
    Me.Minimum_Stoc k.ForeColor = vbRed
    ElseIf Me.Colour = "Green" And Me.Minimum_Stoc k > Me.Stock Then
    Me.Minimum_Stoc k.ForeColor = vbGreen
    ElseIf Me.Colour = "Blue" And Me.Minimum_Stoc k > Me.Stock Then
    Me.Minimum_Stoc k.ForeColor = vbBlue
    ElseIf Me.Colour = "Black" And Me.Minimum_Stoc k > Me.Stock Then
    Me.Minimum_Stoc k.ForeColor = vbBlack
    ElseIf Me.Colour = "Yellow" And Me.Minimum_Stoc k > Me.Stock Then
    Me.Minimum_Stoc k.ForeColor = vbYellow
    End If
    End Sub

    But im having a few problems, what happens is for example, if the colour black stock is greater then its minimum stock that stays black which it should but then if the blue minimum stock is greater then stock it goes blue which it should. The problem is now when i go back to the colour black it has turned blue. For some reason it is picking up the colour blue.

    Does anyone have any ideas why and how to stop this?
Working...