Hello:
I am having a tough time getting a query that runs in my VB app to work in Crystal reports. Basically, I am making several reports with a join between two tables: Master and Action(personal data and work history). Now some reports, need only the MOST-RECENT work history for current employees (where they currently are now), for this I use the Max SQL command and I wrote a nested query. This query provides the records I need and it works for creating an Access Report.
Now, in Crystal, I am trying to re-create the reports....I am re-writing this application in ADO and VB 6.0. I have two tables in my Crystal Report and I can get the report to display ALL employee records, I have linked the two tables via the SSNO field. The problem is, I can't get the Max Date to work in Crystal Syntax. Here is what I have so farthis like the current query that works in VB, you can see what I am trying to do):
ADO Table1:
select DISTINCT master.SSNO, master.LAST,master.FIRST, master.MIDDLE,master.SEXIN, Action.Max_Date FROM master INNER JOIN Current2 ON Master.SSNO = Current2.SSNO
ADO Table2:
select DISTINCT Action.SSNO, Action.rc, MAX(Action.Datein) As Max_Date, Action.status, Action.class FROM Action INNER JOIN Master ON Action.SSNO = Master.SSNO GROUP BY Action.SSNO, Action.rc, Action.status, Action.class
Now please note, ADO Table2 compiles fine: it takes Max(Action.DateIn) As Max_Date. The problem is, I can't pass this to the first table (the statements Action.Max_Date is not accepted by Crystal). So I get 6 records for an employee (all that exist on the action table) instead of the one most recent I need. Can anyone help me with this, how do I pass this query to my report? I am new to Crystal so if this isn't the best way to do this, sorry, can you help . I am fluent in VB and SQL. Thanks
I am having a tough time getting a query that runs in my VB app to work in Crystal reports. Basically, I am making several reports with a join between two tables: Master and Action(personal data and work history). Now some reports, need only the MOST-RECENT work history for current employees (where they currently are now), for this I use the Max SQL command and I wrote a nested query. This query provides the records I need and it works for creating an Access Report.
Now, in Crystal, I am trying to re-create the reports....I am re-writing this application in ADO and VB 6.0. I have two tables in my Crystal Report and I can get the report to display ALL employee records, I have linked the two tables via the SSNO field. The problem is, I can't get the Max Date to work in Crystal Syntax. Here is what I have so farthis like the current query that works in VB, you can see what I am trying to do):
ADO Table1:
select DISTINCT master.SSNO, master.LAST,master.FIRST, master.MIDDLE,master.SEXIN, Action.Max_Date FROM master INNER JOIN Current2 ON Master.SSNO = Current2.SSNO
ADO Table2:
select DISTINCT Action.SSNO, Action.rc, MAX(Action.Datein) As Max_Date, Action.status, Action.class FROM Action INNER JOIN Master ON Action.SSNO = Master.SSNO GROUP BY Action.SSNO, Action.rc, Action.status, Action.class
Now please note, ADO Table2 compiles fine: it takes Max(Action.DateIn) As Max_Date. The problem is, I can't pass this to the first table (the statements Action.Max_Date is not accepted by Crystal). So I get 6 records for an employee (all that exist on the action table) instead of the one most recent I need. Can anyone help me with this, how do I pass this query to my report? I am new to Crystal so if this isn't the best way to do this, sorry, can you help . I am fluent in VB and SQL. Thanks