Solved

check marks not turning black

Posted on 2012-12-26
3
264 Views
Last Modified: 2012-12-27
I got help from the experts and everything is working fine except only one  label is turning black cant figure out wnat the problem.

On clicking the check mark it is suppose to disable and turn black and only the first label is turning black. Here is the code and th DB

Private Sub Form_Current()
Dim i As Byte
    Dim sNum As String
    Dim isChecked As Boolean
   
    For i = 1 To 18
        sNum = Format(i, "00")
        isChecked = Me("chk" & sNum)
        Me("lbl" & sNum).BackColor = IIf(isChecked, vbBlack, vbWhite)
        Me("chk" & sNum).Enabled = Not isChecked
   
    Next
   
End Sub

Private Sub DisableMe(sCtrlName As String)

    sNum = Mid(sCtrlName, 4)
    Me("btn" & sNum).SetFocus
    Me("lbl" & sNum).BackColor = vbBlack
    Me(sCtrlName).Enabled = False

End Sub

Private Sub ResetMe(sCtrlName As String)
    Dim sNum As String
   
    sNum = Mid(sCtrlName, 4)
    Me("lbl" & sNum).BackColor = vbWhite
    Me("chk" & sNum).Enabled = True
    Me("chk" & sNum) = False

End Sub

Private Sub btn01_Click()
    ResetMe (ActiveControl.Name)
End Sub
Private Sub btn02_Click()
    ResetMe (ActiveControl.Name)
End Sub
Private Sub btn03_Click()
    ResetMe (ActiveControl.Name)
End Sub
Private Sub btn04_Click()
    ResetMe (ActiveControl.Name)
End Sub
Private Sub btn05_Click()
    ResetMe (ActiveControl.Name)
End Sub
Private Sub btn06_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn07_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn08_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn09_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn10_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn11_Click()
    ResetMe (ActiveControl.Name)
End Sub


Private Sub btn12_Click()
    ResetMe (ActiveControl.Name)
End Sub



Private Sub btn13_Click()
    ResetMe (ActiveControl.Name)
End Sub


Private Sub btn14_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn15_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn16_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn17_Click()
    ResetMe (ActiveControl.Name)
End Sub

Private Sub btn18_Click()
    ResetMe (ActiveControl.Name)
End Sub







Private Sub chk01_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk02_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk03_AfterUpdate()
    DisableMe (ActiveControl.Name)
End Sub
Private Sub chk04_AfterUpdate()
    DisableMe (ActiveControl.Name)
End Sub


Private Sub chk05_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk06_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk07_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk08_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk09_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub


Private Sub chk10_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk11_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk12_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk13_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk14_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk15_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk16_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk17_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub

Private Sub chk18_AfterUpdate()
DisableMe (ActiveControl.Name)
End Sub
bingo3.zip
0
Comment
Question by:gigifarrow
3 Comments
 
LVL 30

Accepted Solution

by:
hnasr earned 250 total points
ID: 38722792
In design mode, select label, and set Back Style to Normal.
0
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 250 total points
ID: 38722911
Also you could make the code I gave you a bit better with this revision:
Private Sub DisableMe()
    Dim sCtrlName As String
    Dim sNum As String
 
    sCtrlName = ActiveControl.Name
    sNum = Mid(sCtrlName, 4)
    Me("btn" & sNum).SetFocus
    Me("lbl" & sNum).BackColor = vbBlack
    Me(sCtrlName).Enabled = False

End Sub

Private Sub ResetMe()
    Dim sCtrlName As String
    Dim sNum As String
    
    sCtrlName = ActiveControl.Name
    sNum = Mid(sCtrlName, 4)
    Me("lbl" & sNum).BackColor = vbWhite
    Me("chk" & sNum).Enabled = True
    Me("chk" & sNum) = False

End Sub

Open in new window

Then your other procedures would be shortened to this:
Private Sub btn01_Click()
    ResetMe
End Sub

Private Sub chk01_AfterUpdate()
    DisableMe
End Sub

Open in new window

0
 
LVL 20

Expert Comment

by:clarkscott
ID: 38723454
Controls on tabular lists are not separate objects.  There are single objects that repeat for each record on the list.  With that said, you will have a hard time controlling certain objects on screen forms lists.

You can try Conditional Formatting for some of these controls.  This is a built-in feature of Access and can control certain formats for certain controls.

For example.... you can Lock a control on a tabular record based on other field values in the record... but you've actually locked the control on all the records... you just can't tell (or see it) because you're focused on the single record.  If you click to another record... it seems like that single control may be locked or not.   Now... if you try to control the source of a combo box in a single record.... each time you focus on another record... ALL the visible combos will change their record source.

You might want to figure out a different method for your visualizations.

Scott C
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now