specify the style of form for each record

negin1313

New member
Local time
Today, 13:25
Joined
Dec 8, 2012
Messages
4
:confused:how can i specify the style of form for each record?is it have any spesific aspect for each record in form? is there any way to solve this problem?can i write it in visual basic than all record have a different style :banghead:
 
Here are two methods:

Code:
Private Function OriginalsFeatures()

    With CodeContextObject
        If Forms![Menu]![Company Region] = "L" Then
            If Not IsNull(.[Orig 3rd Party]) Or .[Orig Supplier Vat Code] <> 0 Then
                .[Orig Sell Net].BackColor = 8388608
                .[Orig Sell Net].ForeColor = 16777215
                .[Orig Sell].BackColor = 16777215
                .[Orig Sell].ForeColor = 0
            ElseIf (IsNull(.[Orig 3rd Party ]) Or .[Orig Supplier Vat Code] = 0) Then
                .[Orig Sell].BackColor = 8388608
                .[Orig Sell].ForeColor = 16777215
                .[Orig Sell Net].BackColor = 16777215
                .[Orig Sell Net].ForeColor = 0
            End If
        End If

        If .[Orig Stock Status] = "P" And .[StockStatus] <> "P" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals_Purchase.png"
            .Picture = "C:\Databases\Livery\Background\Originals_Purchase.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals_Purchase.png"
            .[StockStatus] = "P"
        ElseIf .[Orig Stock Status] = "H" And .[StockStatus] <> "H" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals_History.png"
            .Picture = "C:\Databases\Livery\Background\Originals_History.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals_History.png"
            .[StockStatus] = "H"
        ElseIf .[Orig Stock Status] = "C" And .[StockStatus] <> "C" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals.png"
            .Picture = "C:\Databases\Livery\Background\Originals.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals.png"
            .[StockStatus] = "C"
        End If
    End With
End Function

Simon
 
please some one put its access file becuase i cant figure out what should i do

i really confused




Here are two methods:

Code:
Private Function OriginalsFeatures()
 
    With CodeContextObject
        If Forms![Menu]![Company Region] = "L" Then
            If Not IsNull(.[Orig 3rd Party]) Or .[Orig Supplier Vat Code] <> 0 Then
                .[Orig Sell Net].BackColor = 8388608
                .[Orig Sell Net].ForeColor = 16777215
                .[Orig Sell].BackColor = 16777215
                .[Orig Sell].ForeColor = 0
            ElseIf (IsNull(.[Orig 3rd Party ]) Or .[Orig Supplier Vat Code] = 0) Then
                .[Orig Sell].BackColor = 8388608
                .[Orig Sell].ForeColor = 16777215
                .[Orig Sell Net].BackColor = 16777215
                .[Orig Sell Net].ForeColor = 0
            End If
        End If
 
        If .[Orig Stock Status] = "P" And .[StockStatus] <> "P" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals_Purchase.png"
            .Picture = "C:\Databases\Livery\Background\Originals_Purchase.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals_Purchase.png"
            .[StockStatus] = "P"
        ElseIf .[Orig Stock Status] = "H" And .[StockStatus] <> "H" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals_History.png"
            .Picture = "C:\Databases\Livery\Background\Originals_History.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals_History.png"
            .[StockStatus] = "H"
        ElseIf .[Orig Stock Status] = "C" And .[StockStatus] <> "C" Then
            .[Label_Header].Picture = "C:\Databases\Livery\Forms\Header_Originals.png"
            .Picture = "C:\Databases\Livery\Background\Originals.jpg"
            .Header_Background.Picture = "C:\Databases\Livery\Header\Originals.png"
            .[StockStatus] = "C"
        End If
    End With
End Function

Simon
 
1. Open access and open your file and press alt+f11.
2. on the left side click on project explorer and and go to module.
3. create new module and put this all code after the Option Compare Database option.
and from where u an call this finction...
hope to understand...
 
hi and thanks for your reply i did it but it didnt work please see my file :
in this case that i wrote i get my answer

Private Sub field2_Enter()
If field2 = 5 Then
field2.BackColor = 6388608
Else
field2.BackColor = 16777215
End If
End Sub

but i need my field to be locked instead of changing in color
but when i change my macros to this it dosent work


Private Sub field2_Enter()
If field2 = 5 Then
field2.enable= false
Else
Me.AllowEdits = True
field2.enable = true
End If
End Sub
 

Attachments

Users who are viewing this thread

Back
Top Bottom