How do I write this SQL SELECT statement?

R

Ron

I have a TABLE, called coursesection I have fields in that table
called SCHEDULENO, COURSEID, SECTIONNO, FACULTYID

I want to write a select statement that will display the SCHEDULENO,
COURSEID, SECTIONNO for the FACULTY ID that is currently being
displayed on a form.

And then I want to want to show this in a Lisbox for example.

how would I do something like this?
 
K

Ken Snell \(MVP\)

SELECT SCHEDULENO, COURSEID, SECTIONNO, FACULTYID
FROM coursesection
WHERE FACULTYID = Forms!FormName!ControlNameWithFacultyIDValue;
 
R

Ron

OK I put this in the row source of my listbox and nothing shows up as I
scroll through my facultyID's on the form

SELECT coursesection.SCHEDULENO, coursesection.COURSEID,
coursesection.SECTION
FROM coursesection
WHERE
(((coursesection.FACULTYID)=[Forms]![FrmFaculty]![txtfacultyid]));

any ideas?
 
R

Ron

OK my mistake, it displays the info for the first record but not as i
scroll through records, do i need the select in the afterupdate for
the listbox? so that the listbox changes as I select through the
records?
OK I put this in the row source of my listbox and nothing shows up as I
scroll through my facultyID's on the form

SELECT coursesection.SCHEDULENO, coursesection.COURSEID,
coursesection.SECTION
FROM coursesection
WHERE
(((coursesection.FACULTYID)=[Forms]![FrmFaculty]![txtfacultyid]));

any ideas?

SELECT SCHEDULENO, COURSEID, SECTIONNO, FACULTYID
FROM coursesection
WHERE FACULTYID = Forms!FormName!ControlNameWithFacultyIDValue;
 
K

Ken Snell \(MVP\)

You need to use the form's Current event to requery the listbox when you
move from one record to another; that will refresh the listbox's contents to
by synchronized with the current record:

Private Sub Form_Current()
Me.NameOfYourListBox.Requery
End Sub

--

Ken Snell
<MS ACCESS MVP>

Ron said:
OK my mistake, it displays the info for the first record but not as i
scroll through records, do i need the select in the afterupdate for
the listbox? so that the listbox changes as I select through the
records?
OK I put this in the row source of my listbox and nothing shows up as I
scroll through my facultyID's on the form

SELECT coursesection.SCHEDULENO, coursesection.COURSEID,
coursesection.SECTION
FROM coursesection
WHERE
(((coursesection.FACULTYID)=[Forms]![FrmFaculty]![txtfacultyid]));

any ideas?

SELECT SCHEDULENO, COURSEID, SECTIONNO, FACULTYID
FROM coursesection
WHERE FACULTYID = Forms!FormName!ControlNameWithFacultyIDValue;

--

Ken Snell
<MS ACCESS MVP>

I have a TABLE, called coursesection I have fields in that table
called SCHEDULENO, COURSEID, SECTIONNO, FACULTYID

I want to write a select statement that will display the SCHEDULENO,
COURSEID, SECTIONNO for the FACULTY ID that is currently being
displayed on a form.

And then I want to want to show this in a Lisbox for example.

how would I do something like this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top