sydneyguy
asked on
passing a value from an access textbox to sqlserver view
Hi experts I need to pass a textbox varable accross to a view in sql server 2005
What I have is a field called ID to access the data on the form I would use [Forms!teacheraccessmain!I D.Value] = "27" the value that will be in the value will be the ID log in value of a user, the sytem will use this information to return data that will be displayed only relating to them. what happens is I have a access front end passing off to a SQl server for DB access. I am putting in palce a small secure access DB that allows the user to display and change only records that when the user logs in with there ID number I use this number to filter the view in SQlserver to return only there information. just not sure how to extract the data in the textbox and feed this into the view.. any ideas. the system has to run in Access and only access..
the view as it now stands is
SELECT TOP (100) PERCENT dbo.Teacher.TeacherID, dbo.Teacher.TeachFName, dbo.Teacher.TeachLName, dbo.Class.ClassID, dbo.Student.FamilyName,
dbo.Student.GivenName, dbo.StudentCourse.StudCour seID, dbo.StudentCourse.Qualific ationIssue d, dbo.Class.ClassDesc,
dbo.StudentModules.ModuleI D, dbo.StudentModules.Status, dbo.StudentModules.DateCom plete, dbo.StudentModules.FinalEx amMark,
dbo.StudentModules.FinalEx amMarkDate , dbo.StudentModules.retest, dbo.StudentModules.retestd ate, dbo.StudentModules.adminev al,
dbo.StudentModules.adminev aldate, dbo.StudentModules.modulec losed, dbo.Attendance.AttendanceI D, dbo.Attendance.StudentID
FROM dbo.StudentCourse INNER JOIN
dbo.Student ON dbo.StudentCourse.StudentI D = dbo.Student.StudentID INNER JOIN
dbo.StudentModules ON dbo.StudentCourse.StudCour seID = dbo.StudentModules.StudCou rseID INNER JOIN
dbo.Attendance ON dbo.Student.StudentID = dbo.Attendance.StudentID INNER JOIN
dbo.Teacher INNER JOIN
dbo.Class ON dbo.Teacher.TeacherID = dbo.Class.TeacherID ON dbo.Attendance.ClassID = dbo.Class.ClassID
ORDER BY dbo.Teacher.TeacherID, dbo.Class.ClassID
What I have is a field called ID to access the data on the form I would use [Forms!teacheraccessmain!I
the view as it now stands is
SELECT TOP (100) PERCENT dbo.Teacher.TeacherID, dbo.Teacher.TeachFName, dbo.Teacher.TeachLName, dbo.Class.ClassID, dbo.Student.FamilyName,
dbo.Student.GivenName, dbo.StudentCourse.StudCour
dbo.StudentModules.ModuleI
dbo.StudentModules.FinalEx
dbo.StudentModules.adminev
FROM dbo.StudentCourse INNER JOIN
dbo.Student ON dbo.StudentCourse.StudentI
dbo.StudentModules ON dbo.StudentCourse.StudCour
dbo.Attendance ON dbo.Student.StudentID = dbo.Attendance.StudentID INNER JOIN
dbo.Teacher INNER JOIN
dbo.Class ON dbo.Teacher.TeacherID = dbo.Class.TeacherID ON dbo.Attendance.ClassID = dbo.Class.ClassID
ORDER BY dbo.Teacher.TeacherID, dbo.Class.ClassID
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I know I have to create a new query but what I require is an example of what the data passed to the query would look like, have not been a big user of this area but was tring to find out whether I pass a value of for example see below
FROM dbo.StudentCourse INNER JOIN
dbo.Student ON dbo.StudentCourse.StudentI
dbo.StudentModules ON dbo.StudentCourse.StudCour
dbo.Attendance ON dbo.Student.StudentID = dbo.Attendance.StudentID INNER JOIN
dbo.Teacher INNER JOIN
dbo.Class ON dbo.Teacher.TeacherID = dbo.Class.TeacherID ON dbo.Attendance.ClassID = dbo.Class.ClassID
where studentID = Forms!teacheraccessmain!ID
****** it is the above value Forms!teacheraccessmain!ID