Solved

check marks not turning black

Posted on 2012-12-26
3
262 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

705 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

20 Experts available now in Live!

Get 1:1 Help Now