Microsoft
Software
Hardware
Network
Question : SQL query to limit selection based on current record
I am trying to create a drop down in a form that will limit the fields based on the currently selected record. The following query lists exactly what records I need however when I try to use it as a rowsource in a form MS Access changes the WHERE clause by dropping reference to the form leaving it as "tblHospitalSpecialties.Ho
spitalId)=
[HospitalI
D]" so when I try to use the dropdown I get every entry in tblHospitalSpecialties instead of just those that relate to the hospital record I have selected. What am I doing wrong?
SELECT tblSpecialties.SpecialtyNa
me, tblSpecialties.SpecialtyId
, tblHospitalSpecialties.Hos
pitalId
FROM tblSpecialties RIGHT JOIN tblHospitalSpecialties ON tblSpecialties.SpecialtyId
= tblHospitalSpecialties.Spe
cialtyId
WHERE (((tblHospitalSpecialties.
HospitalId
)=[Forms]!
[frmProces
sAvailabil
ities]![Ho
spitalID])
);
Answer : SQL query to limit selection based on current record
Humm.
Try save the SQL stmt as a saved query - then use the query as the Row Source.
mx
Random Solutions
Backup individual files and folders using Windows 2008 Server Backup
Update Query to Delete everything to thr right: 4th comma
Lost user password on Vista Home Basic notebook. chntpw
Connecting a workstation to existing SBS 2003 network
GRANT ALTER TRACE TO [SomeUser] gives syntax error
GLIBCXX_3.4.9' not found C++
Matching case in SQL
Dell Vista error code 7B, hang at black screen after login, factory retsore
Access 2003 upgrade - user unable to launch parameter queries, or use Report preview button.
Drag and Drop with CRichEditCtrl