Jumat, 02 April 2021

Re: [MSAccessProfessionals] Winning team auto calculate

Duane,

Here is the code that goes in the after update property of the  gtePoints field.

Using the immediate window I added a breakpoint to the code just as you said. Hovering over the variable, I verified that the variables were pulling the correct value.  I used debug.print to also print them so I could watch.

 

I ran this with the immediate window open and the 4 Debug.print statements printed the correct information in the window (gteResID printed 0), however I believe this Sub should have triggered the Function IsWinner and then that should have also triggered variables to print out in the Immediate window.  From what I can tell, this Sub never triggered the Function because I never saw anything show up in the Immediate window for the function.

 

The Sub below always returned a value of 0 in the gteResID  field.

 

 

Private Sub gtePoints_AfterUpdate()

    ' lngFscID is the "game" and corresponds to the gteFscID column of t_EventParticipants

    ' lngGteID is the primary key of t_EventParticipants

    ' strGL is a string value where "G" means the winner has the Greater/higher score

    'Function should return:

    '    winner = 1

    '    loser  = 2

    '    tie    = 3

    '    NA     = -1   only one result

    Me.Dirty = False          'Forces a save of the current record

   

    Me.gteResID = IsWinner(Me.gteFscID, Me.gteGteID, "G")

 

Debug.Print Me.Dirty

Debug.Print Me.gteFscID

Debug.Print Me.gteGteID

Debug.Print Me.gteResID

 

End Sub

 

 

 

So close.  Any thoughts?

 

Bill

Bill Singer

 

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Duane Hookom
Sent: Thursday, April 1, 2021 4:41 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Winning team auto calculate

 

I always go back to using the immediate window and testing. You can add a breakpoint in your code to step through the lines one by one (with [F8]) and hovering over any variable to see its value.

 

Duane

Tidak ada komentar:

Posting Komentar