Jumat, 02 April 2021

Re: [MSAccessProfessionals] Winning team auto calculate

Duane,

Yes there are debug statements in the function.  I do not see anything in the debug window from the function.  In the debug window all I see it the debug statements from the AfterUpdate action.  I did verify that the AfterUpdate property for gtePoints  box says [Event Procedure].

 

The AfterUpdate is firing because the debug prints the results.

It appears as IsWinning is not running.

 

 

Bill Singer

Minnesota.

 

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

 

Hi Bill,

 

If you have debug statements in the function then you should see something in the debug window. Can you confirm the Event Property for the AfterUpdate of the gtePoints text box is [Event Procedure]?

 

Duane

 


From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Bill Singer <Bill.Singer@at-group.net>
Sent: Friday, April 2, 2021 12:07 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: 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