R
Robert Riley
I am a beginner so come get your laughs here.
First, is this the right group for this type of help?
What I am trying to do (big picture) is make a scoring database for the
Cub Scout Olympics. I have got the scoring for the non-time events.
In trying to score the quarter mile run I have come up with the
following, mostly from lurking in the newsgroup, thanks everyone.
But is does not work (that is why I am here asking for help).
The scoring is 1'st = 100, 2 = 90, .....6'th and greater = 50.
The table has fields for autonumber, scout-name, scout-rank, pack
number, pack score, 400 meter run, 400 meter points (five other events
with result field and score field). I might not need the pack score
field in the table, but the pack with the highest combined score gets a
plaque and I thought I might need it. I am trying to do all of this
from the form I made, with the same fields. Anyway I am at this point in
trying to score the quarter mile (400 meter run) What have I done
wrong? The error is about the select statement.
Oh - the Msgbox's are just for me to see the values, a learning tool.
Rob
Private Sub Ctl400_Meter_Run_LostFocus()
Dim Current_Scout_Rank As String
Dim Current_Event As String
Current_Scout_Rank = Forms("scout-event").[Scout Rank].Value
Current_Event = Screen.ActiveControl.Name
MsgBox Current_Scout_Rank
MsgBox Current_Event
'Dim dbs As DAO.Database 'did not work
'Dim rst As DAO.Recordset 'did not work
Dim rst As Recordset
Dim strSQL As String
strSQL = "Select from mytable Where Scout Rank = " & Current_Scout_Rank
& " And " & Current_Event & " = not null;"
MsgBox strSQL
Set dbs = CurrentDb
'Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset) 'did not work
Set rst = dbs.OpenRecordset(strSQL)
If rst.BOF = False And rst.EOF = Flase Then
' ** there is at least one record in the recordset
rst.MoveFirst
Do While rst.EOF = False
MsgBox rst.Fields(x)
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
End Sub
First, is this the right group for this type of help?
What I am trying to do (big picture) is make a scoring database for the
Cub Scout Olympics. I have got the scoring for the non-time events.
In trying to score the quarter mile run I have come up with the
following, mostly from lurking in the newsgroup, thanks everyone.
But is does not work (that is why I am here asking for help).
The scoring is 1'st = 100, 2 = 90, .....6'th and greater = 50.
The table has fields for autonumber, scout-name, scout-rank, pack
number, pack score, 400 meter run, 400 meter points (five other events
with result field and score field). I might not need the pack score
field in the table, but the pack with the highest combined score gets a
plaque and I thought I might need it. I am trying to do all of this
from the form I made, with the same fields. Anyway I am at this point in
trying to score the quarter mile (400 meter run) What have I done
wrong? The error is about the select statement.
Oh - the Msgbox's are just for me to see the values, a learning tool.
Rob
Private Sub Ctl400_Meter_Run_LostFocus()
Dim Current_Scout_Rank As String
Dim Current_Event As String
Current_Scout_Rank = Forms("scout-event").[Scout Rank].Value
Current_Event = Screen.ActiveControl.Name
MsgBox Current_Scout_Rank
MsgBox Current_Event
'Dim dbs As DAO.Database 'did not work
'Dim rst As DAO.Recordset 'did not work
Dim rst As Recordset
Dim strSQL As String
strSQL = "Select from mytable Where Scout Rank = " & Current_Scout_Rank
& " And " & Current_Event & " = not null;"
MsgBox strSQL
Set dbs = CurrentDb
'Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset) 'did not work
Set rst = dbs.OpenRecordset(strSQL)
If rst.BOF = False And rst.EOF = Flase Then
' ** there is at least one record in the recordset
rst.MoveFirst
Do While rst.EOF = False
MsgBox rst.Fields(x)
rst.MoveNext
Loop
End If
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
End Sub