Hi there, My name is Daniel Solis live in the Paso Texas, I'm new in the forum , and I have some experience in Access.
I hope to contribute something in this forum and learn even more things.
This the problem I have, in my table "Master Color" I have four columns "Color, R, G, B" with the color real.
In a report I have two controls TxtColor and TxtLineColor, with data source in another query that contains the color (Text) "not table Master Color"
Example the text in the controls: White, Black, Blue, Dark Blue, Pink, Green, Light Green, Dark Green etc etc.
I need wich if the TxtColor or TxtLineColor control says for example white then look for the white text in the table "Master Color" and if it exists
then add the data from the R, G, B columns in the BackColor control property.
I got part of the objective but they are too many If Then, the ones that I have and I still do not finish with all the combinations. I think this can be simplified but I do not know how to achieve it, I hope you can help me.
Note: In my table I have about 300 different colors.
This is part the code:
I've even tried it with Select Case but it's the same is a very long process.
Let me know you coments please.
:banghead:
I hope to contribute something in this forum and learn even more things.
This the problem I have, in my table "Master Color" I have four columns "Color, R, G, B" with the color real.
In a report I have two controls TxtColor and TxtLineColor, with data source in another query that contains the color (Text) "not table Master Color"
Example the text in the controls: White, Black, Blue, Dark Blue, Pink, Green, Light Green, Dark Green etc etc.
I need wich if the TxtColor or TxtLineColor control says for example white then look for the white text in the table "Master Color" and if it exists
then add the data from the R, G, B columns in the BackColor control property.
I got part of the objective but they are too many If Then, the ones that I have and I still do not finish with all the combinations. I think this can be simplified but I do not know how to achieve it, I hope you can help me.
Note: In my table I have about 300 different colors.
This is part the code:
Code:
Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.TxtColor = "Blue" Then
Me.TxtColor.BackColor = RGB(0, 0, 255)
Me.TxtLineColor.Visible = False
Else
If Me.TxtColor = "Blue Light" Then
Me.TxtColor.BackColor = RGB(135, 206, 250)
Me.TxtLineColor.Visible = False
Else
If Me.TxtColor = "Blue Dark" Then
Me.TxtColor.BackColor = RGB(0, 0, 139)
Me.TxtLineColor.Visible = False
Else
If Me.TxtColor = "Yellow/Blue" Then
Me.TxtColor.BackColor = RGB(255, 255, 0)
Me.TxtLineColor.BackColor = RGB(0, 0, 255)
Else
If Me.TxtColor = "Yellow/Blue Light" Then
Me.TxtColor.BackColor = RGB(255, 255, 0)
Me.TxtLineColor.BackColor = RGB(135, 206, 250)
Else
If Me.TxtColor = "Yellow/Blue Dark" Then
Me.TxtColor.BackColor = RGB(255, 255, 0)
Me.TxtLineColor.BackColor = RGB(0, 0, 139)
Else
If Me.TxtColor = "Yellow/Beige" Then
Me.TxtColor.BackColor = RGB(255, 255, 0)
Me.TxtLineColor.BackColor = RGB(245, 245, 220)
Else
More..more …more….more
I've even tried it with Select Case but it's the same is a very long process.
Let me know you coments please.
:banghead: