Deej
04-04-2002, 02:36 AM
Hello all!
I've got form which is used to add football match fixtures. On it is a textbox for the date the match should be played, and a combo-box into which I want to return a set of data (all the football clubs unavailable to play on a given date). Once the user has entered the date, the combo-box should requery.
The problem is that I need to get the date from the form into the SQL query, so that the combo-box holds the right data. Here's the query I've got at the moment
SELECT clubs.Club_ID, clubs.Club_Name
FROM clubs, matches
WHERE (clubs.Club_ID = matches.HomeClub_ID
OR clubs.Club_ID = matches.AwayClub_ID)
AND matches.Date_Played = CDate("08/09/01")
GROUP BY clubs.Club_ID, clubs.Club_Name;
Obviously the explicit date has to be substituted for some sort of reference to the form, but I don't know what. I tried using the QBE Builder to put in a reference to the form using the forms!formname!Date_Played.text notation, but it was having none of it and returned an empty set.
Any ideas people? I *really* need to get this to work, otherwise I'm going to fail my assignment and thus my course http://www.access-programmers.co.uk/ubb/smile.gif
Cheers for your time!
I've got form which is used to add football match fixtures. On it is a textbox for the date the match should be played, and a combo-box into which I want to return a set of data (all the football clubs unavailable to play on a given date). Once the user has entered the date, the combo-box should requery.
The problem is that I need to get the date from the form into the SQL query, so that the combo-box holds the right data. Here's the query I've got at the moment
SELECT clubs.Club_ID, clubs.Club_Name
FROM clubs, matches
WHERE (clubs.Club_ID = matches.HomeClub_ID
OR clubs.Club_ID = matches.AwayClub_ID)
AND matches.Date_Played = CDate("08/09/01")
GROUP BY clubs.Club_ID, clubs.Club_Name;
Obviously the explicit date has to be substituted for some sort of reference to the form, but I don't know what. I tried using the QBE Builder to put in a reference to the form using the forms!formname!Date_Played.text notation, but it was having none of it and returned an empty set.
Any ideas people? I *really* need to get this to work, otherwise I'm going to fail my assignment and thus my course http://www.access-programmers.co.uk/ubb/smile.gif
Cheers for your time!