Results 1 to 5 of 5

Thread: Help needed with selection formula - joined tables

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Location
    Bunker Hill, WV
    Posts
    154

    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!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Location
    Bunker Hill, WV
    Posts
    154

    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.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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).

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Location
    Bunker Hill, WV
    Posts
    154

    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
  •  



Click Here to Expand Forum to Full Width