I made countless references with SQL books, and Access still reports some syntax errors, or "missing parameter"... Hope some of you to help.
sqlText1 = "SELECT ProgramId, CourseId FROM ProgramDetails WHERE ProgramId = Me.ProgramId;"
sqlText2 = "SELECT StudentId, ProgramId FROM Registrations WHERE ProgramId > 0 AND StudentId = Me.StudentId;"
Also could someone explain me why some of the pros suggest to use "SELECT Table.Field1, Table.Field2 FROM Table" instead of
"SELECT Field1, Field2 FROM Table". At least the SQL books I looked at, this is not a requirement.
Two things, one - instead of using Me.YourField, try using the better Forms!YourFormName!StudentID. That way you can use the code from anywhere. Second - try adding something like this to your statements:
SELECT field FROM table WHERE(field = " & Forms!YourForm!Field & ");
This is for Integer data types. If its text, try this:
SELECT field FROM table WHERE(field = """ & Forms!YourForm!Field & """);