View Full Version : CMD Button Row Source Code WHERE Clause for Today's Date
cleteh
10-20-2015, 08:32 PM
Here is a snippet of my code, I need to complete this to narrow my results to records entered that day. This is on the rowsource property of a command button:
FROM [Check Payments ASC] WHERE [Check Payments ASC].[Date]......
I need to complete this so when I click the button it shows the records entered today instead of all the records....
Thank you for your help
HiTechCoach
10-21-2015, 07:29 PM
Command buttons do not has a row source. A Combo box and List box have a row source. Forms and Reports have a Record source.
Please clarify which object you are adding the SQL to.
It really helps to see the entire SQL statement not judt a small snippet. Since we cant see your database design, it help to see all the SQL.
TIP: The more information we have the better we can help you.
To get today's date use the Date() function
where mydate=date()
to use another date enclose a US formatted date with #
where mydate=#10/22/2015#
cleteh
10-22-2015, 08:33 AM
This is a list box..... So, ill try this tonight: FROM [Check Payments ASC] WHERE [Check Payments ASC].[Date]=[date()]
cleteh
10-22-2015, 08:40 AM
It is a list box.... The computer i'm building this on has no internet connection. The statement is really long(didn't want to type it all out).
It works without the WHERE Clause so it displays all records in the listbox but I only want ones with today's date.
Looking at John's comment below i'm going to try this tonight....... FROM [Check Payments ASC] WHERE [Check Payments ASC].[Date]=[date()]
I've written a lot of SQL but im getting really thrown off by the brackets on rowsource and how theyre being used so im not sure the above syntax is correct.
Thanks for the input or if you have any more suggestions
square brackets are for tables/fields.
Date() is a function, so no [].
cleteh
10-22-2015, 09:03 AM
Thanks Jon
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.