Help w/ syntax

P

Pat Dools

Hello,

I have a baseball statistics database and would like to show the team's
record in its last 10 games in a text box on a form that shows a particular
player's game-by game stats. Here is the code I am attempting to use to
calculate the # of wins in the last 10 games:

= Iif ("[wonlost]","tgamestats" = 1 and (Between max(Me.gamenum) And
max(gamenum)-9),Count("[gamenum]","tgamestats"))

where "[wonlost]" is a field in the 'tgamestats' table that gets set to '1'
if the team wins, and 0 if they lose and me.gamenum is the Game # of the
current record shown by the form. It keeps telling me it doesn't like the
syntax, and I would love some help on this one.
 
B

Bob Quintal

Hello,

I have a baseball statistics database and would like to show the
team's record in its last 10 games in a text box on a form that
shows a particular player's game-by game stats. Here is the code
I am attempting to use to calculate the # of wins in the last 10
games:

= Iif ("[wonlost]","tgamestats" = 1 and (Between max(Me.gamenum)
And max(gamenum)-9),Count("[gamenum]","tgamestats"))

where "[wonlost]" is a field in the 'tgamestats' table that gets
set to '1' if the team wins, and 0 if they lose and me.gamenum is
the Game # of the current record shown by the form. It keeps
telling me it doesn't like the syntax, and I would love some help
on this one.

= Dsum("wonlost","TgameStats","[gamenum] between " &
forms!formname!gamenum -9 & " AND " forms!formname!gamenum & ")"

change formname! you didn't tell us what it is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top