Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to fill a textfield

Status
Not open for further replies.

terraman

Programmer
May 26, 2003
12
NL
Hi all,

I wrote a query that counts all records where the start and enddate are between the start year and end year of a form.
There's one problem though, Access sais it is too complex to evaluate or that it has been typed wrong.
This is my query:

SELECT Count (Student.Number) AS NumberOfStudents
FROM StudentMobility INNER JOIN Contract ON StudentMobility.Studyplace = Contract.Studyplace
WHERE (((StudentMobility.PeriodStart) > "#01/01/Forms!frmContract!kzlPeriod!Column(2)#"
AND (StudentsMobility.PeriodEnd) < &quot;#31/12/Forms!frmContract!kzlPeriod!Column(1)#&quot;
AND (Contract.School)=[Forms]![frmContract]![kzlSchool]
AND (StudentMobility.Studyplace)=[Forms]![frmContract]![kzlStudyplace]));

I got years in kzlPeriod and try to add a date to it;
&quot;#Date YearFromTheForm#&quot;
Is this the past that is to complicated or should be typed different?
Anybody anny idea how to write such a query? And do Access query's support The Form!ComboBox!Column(int) thing?

I want to put it in a textfield (would it work if I selected [query].[NumberOfStudents] as source?

Thanks so much for anny help
 
Shouldn't your syntax be this??
Code:
WHERE (((StudentMobility.PeriodStart) > &quot;#01/01/&quot; & Forms!frmContract!kzlPeriod!Column(2) & &quot;#&quot;

--Shaun Merrill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top