|
-
Aug 26th, 2008, 07:50 AM
#1
Thread Starter
Addicted Member
Help needed with selection formula - joined tables
I have two tables, tblCustomers and tblVisitDate. The CustID field is a unique key in tblCustomers. The CustID field is used to identify the customer in each entry in the tblVisitDate table.
I want to select only the customer records in tblCustomers that have an entry in tblVisitDate matching a specific criteria. Also, I only want to select that record one time (I'm printing mailing labels).
I can perform this function in SQL using the IN and WITH keywords, but I don't know where to start with the CR selection formulas. Any help is appreciated- plus I would also appreciate a link to some online resources that explain how to write formulas.
Thanks in advance!
-
Aug 26th, 2008, 09:00 AM
#2
Re: Help needed with selection formula - joined tables
-
Aug 26th, 2008, 09:27 AM
#3
Thread Starter
Addicted Member
Re: Help needed with selection formula - joined tables
These links have a lot of information I didn't have access to before, and I will print a couple of them out for reference. However, I don't think they have what I need with respect to selecting parent records based on child entries.
I've been playing around with the codce, and here's what I've got so far:
Code:
{tblCustomers.CustID} = ({tblDateVisited.CustID} WHERE {tblDateVisited.PlayerType} = {?PlayerType})
I keep getting a missing ')' error following the WHERE keyword. I'm assuming that WHERE is not a valid keyword in these formulas, but I don't know what else to use. I've also tried something using IN which is a valid keyword, but I don't know the proper syntax, I think.
-
Aug 26th, 2008, 11:26 AM
#4
Re: Help needed with selection formula - joined tables
The Record Selection formula would simply be
{tblDateVisited.PlayerType} = {?PlayerType}
The link between the two tables can be created by using the Visual Linking Expert (note i use Crystal 8.5, no idea if the Linking Expert still applies to later versions).
-
Aug 26th, 2008, 12:15 PM
#5
Thread Starter
Addicted Member
Re: Help needed with selection formula - joined tables
Okay, I've tried the simple approach, but I'm still not seeing any results in the report.
I think I may have a new problem now. When I set the data source for the report in my VB code, I use the following syntax:
Code:
Me.ReportFile.SetDataSource(DsSrchCustRpt.Tables(0))
In other reports I only use one table to draw data from, but in the situation I'm currently working on there are three tables that the report pulls data from. I think my inability to assign data from the other three sources is the problem. How do you designate the data source for three tables?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|