Solved

check marks not turning black

Posted on 2012-12-26
3
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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 …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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