bnotamoslema
Programmer
Hi all,
i've just designed a program using MS Access , this program act as risk calulator ,when someone choose Risk Potential from listbox so risk solution appears in text box ,also one of matrix blocks colored by "8388736" (this matrix consists of 25 label numbered through 1 to 25 ), i've stord data in table called risk_soln ,this table has potental_code, risk_sloution and the label_number of the matrix to be highlited with the "8388736" color, so i've created Recordset to retrive the specified data , the risk solution displayed in the white text box when clicking the button, but when dealing with the label_number it's string data stored in the table ؟؟ how to convert it to label control , i don't want to have 25 if statements to set the required label to be colored , i want to have it dynamically through the recordset
HERE'S THE CODE
Private Sub Command2_Click()
Dim db As Database
Dim Lrs As DAO.Recordset
Dim LSQL As String
Dim ctl As Control
Set db = CurrentDb()
LSQL = "select risk_soln,label_no from risk_soln where pot_code=" & pot
Set Lrs = db.OpenRecordset(LSQL)
Me.risk_soln = Lrs!risk_soln
Set ctl = Nothing
Set ctl.Name = Lrs!label_no
ctl.BackColor = 8388736
End Sub
I GOT ERROR
i've just designed a program using MS Access , this program act as risk calulator ,when someone choose Risk Potential from listbox so risk solution appears in text box ,also one of matrix blocks colored by "8388736" (this matrix consists of 25 label numbered through 1 to 25 ), i've stord data in table called risk_soln ,this table has potental_code, risk_sloution and the label_number of the matrix to be highlited with the "8388736" color, so i've created Recordset to retrive the specified data , the risk solution displayed in the white text box when clicking the button, but when dealing with the label_number it's string data stored in the table ؟؟ how to convert it to label control , i don't want to have 25 if statements to set the required label to be colored , i want to have it dynamically through the recordset
HERE'S THE CODE
Private Sub Command2_Click()
Dim db As Database
Dim Lrs As DAO.Recordset
Dim LSQL As String
Dim ctl As Control
Set db = CurrentDb()
LSQL = "select risk_soln,label_no from risk_soln where pot_code=" & pot
Set Lrs = db.OpenRecordset(LSQL)
Me.risk_soln = Lrs!risk_soln
Set ctl = Nothing
Set ctl.Name = Lrs!label_no
ctl.BackColor = 8388736
End Sub
I GOT ERROR