Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Infopath
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Infopath Programming and automation discussions only please. :)
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Infopath section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 21st, 2007, 03:16 AM
Registered User
Join Date: Nov 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query criteria from two tables in main connection

I need to be able to generate a query that uses conditional criteria from two different tables (one a subsidiary of the other).

I have two tables :

Project Details
    Project Id
    Project Description etc
    Area Id

Contact Details
    Contact Id
    Project Id
    Contact Name etc

I need to be able to be able to query on any of the combined fields .

Example Queries :

1) List all Projects (plus the Contact Details for the Project) where the Contact Id is 5.

2) List all projects that have an area Id of 5 and where the Contact Id is 2.

And so on …………………..

I am using Infopath 2003 and I can not achieve this simple requirement.

Nor can I find any examples in books or on the net.

I have tried to do it through the form handling, through code behind buttons etc …………

Can someone please provide some expertise in this area?

I have created a main connection that has the two tables related together.

If I create the query fields from the main connection, then the query will successfully create the query on the main table (Project Details) and the Contact Details Query conditions will apply to the subsiduary table Contact Details.

I want to return back project details for all entries that have contact id 5 (and maybe some additional conditions on the main table).

If I just enter contactId 5 as the criteria, I get the entire main table returned and then just the contact ids that have 5.

I want the query to find the Project Details where there is a related contact id of 5.


Select * from ProjectDetails where ProjectId in (select ProjectID from ContactTable where ContactId = 5)

Naturally the 5 comes from the form control value.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional criteria in query dfuas Access VBA 1 January 21st, 2006 03:46 AM
Conditional criteria in query dfuas BOOK: Beginning Access VBA 0 January 15th, 2006 03:19 PM
Criteria in Query lryckman Access 1 June 23rd, 2004 11:11 AM
2 Tables - 1 Statement - 1 Output - 1 Criteria sencee PHP Databases 7 May 25th, 2004 04:53 AM
Query Criteria Clive Astley Access 4 March 25th, 2004 03:27 AM

All times are GMT -4. The time now is 04:19 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.