Title: [AccessDevelopers] Modify query WHERE statement based on a form text box
You can reference the text box in the query:
 
SELECT Name, Company
FROM Contacts
WHERE ContactDate > [Forms]![FormName]![txt_Date];
 
HTH,
Toby
----- Original Message -----
Sent: Monday, October 17, 2005 3:46 PM
Subject: [AccessDevelopers] Modify query WHERE statement based on a form text box


I have a form that calls a query with a command button.  The query tells me the most recent contacts I have made.

The query (which actually has a join to handle the 1:m relationship between people and the contacts made with them) is basically:

SELECT Name, Company
FROM Contacts
WHERE ContactDate > #10/17/2005#;

I have a text box in the form that supplies the date for the WHERE staement.

I am using a querydef to rewrite the SQL to insert the date, but I've got to believe there's an easier way to do it.

Does anyone have any ideas?

TIA

Far Farley




Please zip all files prior to uploading to Files section.




SPONSORED LINKS
Microsoft access developer Microsoft access help Microsoft access database
Microsoft access training Microsoft access training course Microsoft access programming


YAHOO! GROUPS LINKS




Reply via email to