Tattslotto number Checker (1 Viewer)

Robert88

Robbie
Local time
, 07:48
Joined
Dec 18, 2004
Messages
335
Hi All,

I have a database which contains all historical draws from our Tattslotto system here in Australia.

I want to get some comments on the best way to tackle checking two tables as listed below.

tblDrawn_No 'This is the table with drawn tattslotto numbers so only one row per draw
fldDraw_No
fldDrawn_No_1
fldDrawn_No_2
fldDrawn_No_3
fldDrawn_No_4
fldDrawn_No_5
fldDrawn_No_6
fldDrawn_No_7 'Supplementary number 1
fldDrawn_No_8 'Supplementary number 2

tblTicketNumbers 'This is a table with 24 rows and 6 coloumns, consisting of 6 numbers selected from 1 - 45 for 24 games.
fldRow ' field to describe each row "A - X" on ticket
fldTicketNumber1
fldTicketNumber2
fldTicketNumber3
fldTicketNumber4
fldTicketNumber5
fldTicketNumber6

So I suppose I want to compare the last row of tblDrawn_No, being the current draw with each fldTicketNumber(1-6) game on the ticket of tblTicketNumbers. Sample attached.

I was hoping to display the output on a form somehow?:confused:

Any help would be appreciated.

Robert88
 

Attachments

  • Tattslotto.zip
    32.9 KB · Views: 275

Sergeant

Someone's gotta do it
Local time
Today, 17:48
Joined
Jan 4, 2003
Messages
638
Try this:

There are many ways to do this (in code). I don't think you can do it with a query, because you have to evaluate each of the six tkt #'s against 8 columns from the Draw table.

I attached a rough sample...
 

Attachments

  • Tattslotto2.zip
    24.4 KB · Views: 224

Robert88

Robbie
Local time
, 07:48
Joined
Dec 18, 2004
Messages
335
Hi Seargent,

Thanks for that, I will have a good look at this.

I was also looking to display the numbers on the form, hopefully displaying them in different colours if matched.

I will give it a go based on what you have done as that shouldn't be too hard from what you have given.

Appreciate it.

Robert88
 

Robert88

Robbie
Local time
, 07:48
Joined
Dec 18, 2004
Messages
335
Hi All,

I was looking to check the numbers from a tattslotto ticket stored in the zip file above Tattslotto.zip in a table tblTicketNumbers.

I was thinking of running routine like one similarly pasted. However was looking to display the results of the routine on a form with different colours on ticket numbers that match drawn numbers.

My question, is this best done on a form or I was thinking of doing it on a report but now not sure which to use.

So before I spend a lot of time either way I thought I would get some advice on which method would be better as I am not sure? :confused:

Look forward to anyones advice.

Robert88
 

Robert88

Robbie
Local time
, 07:48
Joined
Dec 18, 2004
Messages
335
Looking to place different colours on selected numbers?

Hi All,

I am back from the depths, it has been ages since I have played but yes I am back :D

Been working on this code to display the numbers;

Code:
Private Sub CmdCheckTickets_Click()
    Dim rstDraw As DAO.Recordset
    Dim rstTkt As DAO.Recordset
    Dim MainHits As Integer
    Dim Ticket1 As Integer
    Dim Ticket2 As Integer
    Dim Ticket3 As Integer
    Dim Ticket4 As Integer
    Dim Ticket5 As Integer
    Dim Ticket6 As Integer
    Dim SuppHits As Integer
    Dim Hits As Integer
    Dim strAddTkt As String
    Dim strTickNum As String
    Set rstDraw = Me.RecordsetClone
    Set rstTkt = CurrentDb.OpenRecordset("tblTicketNumbers")
    
    Do While Not rstTkt.EOF
        MainHits = 0
        SuppHits = 0
        Hits = 0
        Ticket1 = 0
        Ticket2 = 0
        Ticket3 = 0
        Ticket4 = 0
        Ticket5 = 0
        Ticket6 = 0
        For i = 1 To 6
        
            If i = 1 Then
                Ticket1 = rstTkt.Fields("fldTicketNumber1")
            End If
            If i = 2 Then
                Ticket2 = rstTkt.Fields("fldTicketNumber2")
            End If
            If i = 3 Then
                Ticket3 = rstTkt.Fields("fldTicketNumber3")
            End If
            If i = 4 Then
                Ticket4 = rstTkt.Fields("fldTicketNumber4")
            End If
            If i = 5 Then
                Ticket5 = rstTkt.Fields("fldTicketNumber5")
            End If
            If i = 6 Then
                Ticket6 = rstTkt.Fields("fldTicketNumber6")
            End If
        
            Select Case rstTkt.Fields("fldTicketNumber" & i)
                Case Is = rstDraw.Fields("fldNo_1")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldNo_2")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldNo_3")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldNo_4")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldNo_5")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldNo_6")
                    MainHits = MainHits + 1
                Case Is = rstDraw.Fields("fldSupp1")
                    SuppHits = SuppHits + 1
                Case Is = rstDraw.Fields("fldSupp2")
                    SuppHits = SuppHits + 1
                    
            End Select
        Next i
        Hits = MainHits + SuppHits
        If Hits > -1 Then
            strTickNum = rstTkt.Fields("fldRow") & "; " & Ticket1 & "; " & Ticket2 & "; " & Ticket3 & "; " & Ticket4 & "; " & Ticket5 & "; " & Ticket6
            Me.TicketNumbers.AddItem strTickNum
            strAddTkt = rstTkt.Fields("fldRow") & "; " & MainHits & "; " & SuppHits
            Me.lstWinners.AddItem strAddTkt
        End If
        rstTkt.MoveNext
    Loop
    rstTkt.Close
    rstDraw.Close
    Set rstTkt = Nothing
    Set rstDraw = Nothing


End Sub

Was wondering how hard it was to place different colours on the matching ticket numbers on the code above for the form that automagically opens in the attached file under the button "Matching numbers"?

Is it possible to extend the code above to do so? If so it would be great.:cool:

Look forward to any advice.

Robert88
 

Attachments

  • TATTSLOTTO3.zip
    29.2 KB · Views: 195

Users who are viewing this thread

Top Bottom