OK, first off, this is not for an assignment.
My wife works at the local community college. They've been assigned to take over the English & Math placement testing. The tests are computerized, & if the students don't place as high as they'd like they have the option of going through at least 5 hours of computerized "remediation" (i.e. practice test questions) before retaking it. They can then retake it until a) they get the placement they want, or b) they've enrolled in a class (including Developmental Education/remedial-level courses).
The catch is that the college didn't budget for a separate computer lab, so they're forced to use the existing computer tutoring lab. That's a lot of double-duty, especially for the staff (since most of the tutors don't have the credentials to teach, & they want instructors available).
So, my wife asked if I could come up with some way that they could track how many students come to the lab & why they're in the lab (i.e. testing, remediation, tutoring, etc.). They want to be able to track the number by day of the week, by the hour, & how long the students are there. They don't need to know by individual student, though, & in many cases those students may not even be enrolled, so they won't have a student ID number.
I thought I could maybe set up an Access database & use VBA for data validation & some of the data entry. I have the following:
-- table (Students_in_Lab) with fields for their name (StudentName), date & start/end times they are in the lab, & total time in the lab
-- Login form (Student_Login) where they enter their name, & where the VBA code determines if they're logging in or logging out;
-- Secondary forms (Login_Option & Logout_Option): the latter tells them they've been logged out, the former has them select a reason for using the lab.
I wanted to test my VBA code to see if it was working, so I have it tell me if the name is in the table. Right now it uses MsgBox to give the result of that test (True/False) & either a logged-in or logged-out message, so that I could test its ability to find a student's name.
But...it's not working. I used my own name & multiple names in the table, so I should be getting a "True" message if I use one of them, but instead I always get "False" for the first message.
This is the code I have:
I'm not sure where I'm going wrong on this, or if I should just chuck it & try writing it in VisualBASIC (or something else) instead. The only thing is, I wanted to be able to create reports in Access with it, so I'd prefer sticking to Access if at all possible.
My wife works at the local community college. They've been assigned to take over the English & Math placement testing. The tests are computerized, & if the students don't place as high as they'd like they have the option of going through at least 5 hours of computerized "remediation" (i.e. practice test questions) before retaking it. They can then retake it until a) they get the placement they want, or b) they've enrolled in a class (including Developmental Education/remedial-level courses).
The catch is that the college didn't budget for a separate computer lab, so they're forced to use the existing computer tutoring lab. That's a lot of double-duty, especially for the staff (since most of the tutors don't have the credentials to teach, & they want instructors available).
So, my wife asked if I could come up with some way that they could track how many students come to the lab & why they're in the lab (i.e. testing, remediation, tutoring, etc.). They want to be able to track the number by day of the week, by the hour, & how long the students are there. They don't need to know by individual student, though, & in many cases those students may not even be enrolled, so they won't have a student ID number.
I thought I could maybe set up an Access database & use VBA for data validation & some of the data entry. I have the following:
-- table (Students_in_Lab) with fields for their name (StudentName), date & start/end times they are in the lab, & total time in the lab
-- Login form (Student_Login) where they enter their name, & where the VBA code determines if they're logging in or logging out;
-- Secondary forms (Login_Option & Logout_Option): the latter tells them they've been logged out, the former has them select a reason for using the lab.
I wanted to test my VBA code to see if it was working, so I have it tell me if the name is in the table. Right now it uses MsgBox to give the result of that test (True/False) & either a logged-in or logged-out message, so that I could test its ability to find a student's name.
But...it's not working. I used my own name & multiple names in the table, so I should be getting a "True" message if I use one of them, but instead I always get "False" for the first message.
This is the code I have:
Code:
Private Sub CommandOK_Click()
Dim nameexists As Variant
Dim namecheck As Boolean
nameexists = DLookup("StudentName", "Students_in_Lab", "StudentName = '" & Forms!Student_Login!Student_Name & "'")
namecheck = IsNull(nameexists)
Response = MsgBox(namecheck, vbOKOnly, nameexists)
If namecheck = True Then
Response = MsgBox("Logoff successful", vbOKOnly, "Logged Out")
Else
Response = MsgBox("Login successful", vbOKOnly, "Logged In")
End If
End Sub
I'm not sure where I'm going wrong on this, or if I should just chuck it & try writing it in VisualBASIC (or something else) instead. The only thing is, I wanted to be able to create reports in Access with it, so I'd prefer sticking to Access if at all possible.