S
sam
Hi All,
I have a Student2009 Database With the following Data elements:
FName
LName
SID
HeightIn
WeightLb
DaysPresent
DaysAbsent
Percent
TotalCourseNo
AvgBaseBallScore
AvgBasketBallScore
So now I want to design a screener which will help me find the students I
want based on what I select. I have already started it by designing a custom
form in forms module where I can select the criterias like BaseBallAvg1,
BaseBallAvg2, BasketBallAvg1 and BasketBallAvg2, Height1 and Height2 etc .
here is my code, But it is not working yet and I need some help with it.
PLEASE HELP!
Option Compare Database
Private Sub SearchStudents_Click()
Dim conn As Object, rst1 As Object, strSQL1 As String
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=C:\Documents\Students2009.accdb;" & _
"Jet OLEDBatabase Password=mystudents;"
strSQL1 = "SELECT * " & _
" FROM Students09 WHERE AvgBasketBall BETWEEN " & _
Me.BasketBallAvg1.Value & _
" AND" & _
Me.BasketBallAvg2.Value & _
" AND AvgBaseBall BETWEEN" & _
Me.BaseBallAvg1.Value & _
" AND" & _
Me.BaseBallAvg2.Value & _
" AND Height BETWEEN" & _
Me.Height1.Value & _
" AND" & _
Me.Height2.Value & _
Set rst1 = conn.Execute(strSQL1)
Set rst1 = Nothing
Set conn = Nothing
End Sub
NOTE: Here BaseBallAvg1, BaseBallAvg2, BasketBallAvg1 and BasketBallAvg2 are
text boxes AND Height1 and Height2 are Comboboxes.
Thanks in Advance
I have a Student2009 Database With the following Data elements:
FName
LName
SID
HeightIn
WeightLb
DaysPresent
DaysAbsent
Percent
TotalCourseNo
AvgBaseBallScore
AvgBasketBallScore
So now I want to design a screener which will help me find the students I
want based on what I select. I have already started it by designing a custom
form in forms module where I can select the criterias like BaseBallAvg1,
BaseBallAvg2, BasketBallAvg1 and BasketBallAvg2, Height1 and Height2 etc .
here is my code, But it is not working yet and I need some help with it.
PLEASE HELP!
Option Compare Database
Private Sub SearchStudents_Click()
Dim conn As Object, rst1 As Object, strSQL1 As String
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=C:\Documents\Students2009.accdb;" & _
"Jet OLEDBatabase Password=mystudents;"
strSQL1 = "SELECT * " & _
" FROM Students09 WHERE AvgBasketBall BETWEEN " & _
Me.BasketBallAvg1.Value & _
" AND" & _
Me.BasketBallAvg2.Value & _
" AND AvgBaseBall BETWEEN" & _
Me.BaseBallAvg1.Value & _
" AND" & _
Me.BaseBallAvg2.Value & _
" AND Height BETWEEN" & _
Me.Height1.Value & _
" AND" & _
Me.Height2.Value & _
Set rst1 = conn.Execute(strSQL1)
Set rst1 = Nothing
Set conn = Nothing
End Sub
NOTE: Here BaseBallAvg1, BaseBallAvg2, BasketBallAvg1 and BasketBallAvg2 are
text boxes AND Height1 and Height2 are Comboboxes.
Thanks in Advance