grundig1987
Registered User.
- Local time
- Today, 01:39
- Joined
- Dec 22, 2010
- Messages
- 31
I am trying to set up an SQL statement based on some VBA:
I have set up an access form which has various combo boxes and text boxes - I have set up some VBA to record certain aspects of the data, which is below:
StudentCourse = Combo_Show_Students.Value
Creditsoncourse = DLookup("[CourseCredits]", "Courses", "[CourseID] = '" & Combo11.Value & "'")
SemesterCourse = DLookup("[COurseSemester]", "Courses", "[CourseID] = '" & Combo11.Value & "'")
So for example, the StudentCourse could be B787878, the CreditsonCourse could be 20, and SemesterCourse could be 1.
I have set up another list box which I want to run off a query, the query being show StudentID from 'EnrolmentsSecondary' Where StudentID = StudentCourse, CourseSemester = SemesterCourse, and CourseCredits = CreditsonCourse.
The SQL I have is below:
SELECT EnrolmentsSecondary.CourseID
FROM EnrolmentsSecondary, Courses
WHERE (((EnrolmentsSecondary.StudentID)='" & StudentCourse & "';") AND ((Courses.CourseSemester)='" & SemesterCourse & "';") AND ((Courses.CourseCredits)='" & CreditsonCourse & "';"))
This does not appear to be working correctly - Any ideas what I am doing wrong?
Thanks,
Mark
I have set up an access form which has various combo boxes and text boxes - I have set up some VBA to record certain aspects of the data, which is below:
StudentCourse = Combo_Show_Students.Value
Creditsoncourse = DLookup("[CourseCredits]", "Courses", "[CourseID] = '" & Combo11.Value & "'")
SemesterCourse = DLookup("[COurseSemester]", "Courses", "[CourseID] = '" & Combo11.Value & "'")
So for example, the StudentCourse could be B787878, the CreditsonCourse could be 20, and SemesterCourse could be 1.
I have set up another list box which I want to run off a query, the query being show StudentID from 'EnrolmentsSecondary' Where StudentID = StudentCourse, CourseSemester = SemesterCourse, and CourseCredits = CreditsonCourse.
The SQL I have is below:
SELECT EnrolmentsSecondary.CourseID
FROM EnrolmentsSecondary, Courses
WHERE (((EnrolmentsSecondary.StudentID)='" & StudentCourse & "';") AND ((Courses.CourseSemester)='" & SemesterCourse & "';") AND ((Courses.CourseCredits)='" & CreditsonCourse & "';"))
This does not appear to be working correctly - Any ideas what I am doing wrong?
Thanks,
Mark