I'm trying to make an access form to simulate a Sudoku puzzle. So if you know Sudoku and you understand what a "Candidate" is... you'll know there are 729 candidates on a standard Sudoku puzzle. So I have 729 labels.
I want to be able to single click a label and set the label.caption to the appropriate candidate number. Or double click it and clear the label.
Currently I have the first 2 block of 9 candidates working... but it's going to be way too much code. So please help me reduce it.
My pseudo code would be...
Like I said, the above code is working... but I don't want to repeat it 729 total times... so any help on this would be appreciated. Thanks in advance,
AJ
I want to be able to single click a label and set the label.caption to the appropriate candidate number. Or double click it and clear the label.
Currently I have the first 2 block of 9 candidates working... but it's going to be way too much code. So please help me reduce it.
My pseudo code would be...
Code:
[green]'all my candidate labels are named "Box###" and the last number is the candidate number. So Box122 would be the first set of 9, second block, candidate position 2.[/green]
If any label on the form is clicked...
If the label.name starts with "B" [green] 'because there are other labels I don't want to apply this code to [/green]
Set label.caption = last character of the label.name
If any label on the form is double-clicked...
Set label.caption = ""
[green] 'oh and if you were curious, currently I've got it coded like this...[/green]
Private Sub Box111_Click()
Call passbox("Box111")
End Sub
Private Sub Box111_DblClick(Cancel As Integer)
Call clearbox("Box111")
End Sub
Private Sub Box112_Click()
Call passbox("Box112")
End Sub
Private Sub Box112_DblClick(Cancel As Integer)
Call clearbox("Box112")
End Sub
Private Sub Box113_Click()
Call passbox("Box113")
End Sub
Private Sub Box113_DblClick(Cancel As Integer)
Call clearbox("Box113")
End Sub
[green] Etc....[/green]
Sub passbox(xx As String)
With Me.Controls(xx)
.Caption = Right(xx, 1)
End With
End Sub
Sub clearbox(xx As String)
With Me.Controls(xx)
.Caption = ""
End With
End Sub
Like I said, the above code is working... but I don't want to repeat it 729 total times... so any help on this would be appreciated. Thanks in advance,
AJ