Query form with date ranges or dropdown

G

GTP

Been looking for information on the web and in Microsoft. Still no luck.

I built a form in Infopath with an acess datasource. I want to query the
database by date range. How do I do this. There appears to be no date range
function, I can query by date only but no range.

If the user chooses not to query by date range, instead they can query by
customer. I want the query to be either by date range or by the company
dropdown. How do I accompish the either or?

Thanks,
Greg
 
A

Adam Harding

Design your query form and populate with query fields NOT data fields.

Then have a query button and it will choose whatever data you have entered
to search in those fields.

As far as i am aware if you design you query in your access dbase on the
date range thing then infopath can import the query i am not sure how but
give that a bash for this.
 
S

Scott L. Heim [MSFT]

Hi Greg,

In order to query using "wildcards" or a date range, you will need to
construct the query string in code. The following Knowledge Base article
should provide a good start:

826992: How To: Use Wildcard Characters in an InfoPath Form Query
http://support.microsoft.com/default.aspx?scid=kb;EN-US;826992

You can use the premise in this article and simply modify this to use dates
from your form.

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Scott L. Heim [MSFT]

Hi Greg,

If you run into issues implementing this, let me know as I can provide you
with sample steps using the Northwind database.

Best regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

GTP

Thanks for the reply. I am a real novice when it comes to code. I thought
there would be a simplier way of inserting two date pickers, and maybe a
condition or some sort of formula. I'm going to have a crack at the code but
as I said, I am a novice. Also, my Access database is much smaller than the
NWDB, I only have three tables, and I made a Query in Access for the Query
form in Infopath, I;m not sure if I actually had to make a Query in Access,
do I.

Thanks,
Greg
 
S

Scott L. Heim [MSFT]

Hi Greg,

Unfortunately there is no way to do a "date range" query through the UI -
it will have to be custom code. As I mentioned, if you run into a wall let
me know and I will provide you with the steps to test this against the
Orders table in the Northwind sample database.

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top