Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

check marks not turning black

Posted on 2012-12-26
3
Medium Priority
?
273 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 31

Accepted Solution

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

Assisted Solution

by:IrogSinta
IrogSinta earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

916 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