Private Sub Form_Load()
Dim warning_query As String
Dim query As String
Dim db_name As String
warning_query = "IIF(Score<75, 'WARNING', '') AS " & _
"Warning "
query = "SELECT FirstName, LastName, TestNumber, Score, " & _
"" & _
warning_query & _
"FROM Students, TestScores " & _
"WHERE Students.StudentId = TestScores.StudentId " _
& _
"ORDER BY FirstName, LastName, TestNumber"
db_name = App.Path
If Right$(db_name, 1) <> "\" Then db_name = db_name & _
"\"
Data1.DatabaseName = db_name & "StudentData.mdb"
Data1.RecordSource = query
End Sub
|