anubis7000
Programmer
Hi,
I am having a problem with dynamically sorting/grouping data in my report at runtime. My problem is that when the report is run using sorting/grouping I am missing data.
Specifically, my situation is that I have a query that contains results from 2 tables that have a one to many relationship to each other (ex. 1=Pet, M=Shots, 1 pet can have multiple shots). This query is the dataset for my report.
I want to be able sort by fields from both “Pet” and “Shots”, so I am using the following code:
Me.GroupLevel(0).ControlSource = “<Pet field name goes here>”
Me.GroupLevel(1).ControlSource = “<Shot field name goes here>”
In the report, I have two default group headers, “Groupheader1” (corresponding to Pet) and “Groupheader2” (corresponding to shots) which are preset to sort by Pet primary key and Shot primary key.
The user decides which fields to sort by on a secondary selection form.
My problem is that when I open the report, I am missing records from the report. I have noticed two things: 1) if the record has a null entry in a field that I sorted by (ex. PET_NAME, 80% of the time it will not show up 2) occasionally, the record belonging to “Pet” will not appear on the report, but the “Shot” fields will appear but they will be shown belonging to another “Pet.”
This is kind of a bizarre error. I tried looking at the query itself, and all the records are shown. If I do not run any sorting or grouping on the report, all the records are displayed. I tried exporting my tables/forms/queries/reports to another mdb file. All attempts have been unsuccessful.
I tried using the “OrderBy” and “OrderByOn” properties, but they do not seem to even work as when I use them the report remains unsorted.
Any suggestions? Thanks in advance.
I am having a problem with dynamically sorting/grouping data in my report at runtime. My problem is that when the report is run using sorting/grouping I am missing data.
Specifically, my situation is that I have a query that contains results from 2 tables that have a one to many relationship to each other (ex. 1=Pet, M=Shots, 1 pet can have multiple shots). This query is the dataset for my report.
I want to be able sort by fields from both “Pet” and “Shots”, so I am using the following code:
Me.GroupLevel(0).ControlSource = “<Pet field name goes here>”
Me.GroupLevel(1).ControlSource = “<Shot field name goes here>”
In the report, I have two default group headers, “Groupheader1” (corresponding to Pet) and “Groupheader2” (corresponding to shots) which are preset to sort by Pet primary key and Shot primary key.
The user decides which fields to sort by on a secondary selection form.
My problem is that when I open the report, I am missing records from the report. I have noticed two things: 1) if the record has a null entry in a field that I sorted by (ex. PET_NAME, 80% of the time it will not show up 2) occasionally, the record belonging to “Pet” will not appear on the report, but the “Shot” fields will appear but they will be shown belonging to another “Pet.”
This is kind of a bizarre error. I tried looking at the query itself, and all the records are shown. If I do not run any sorting or grouping on the report, all the records are displayed. I tried exporting my tables/forms/queries/reports to another mdb file. All attempts have been unsuccessful.
I tried using the “OrderBy” and “OrderByOn” properties, but they do not seem to even work as when I use them the report remains unsorted.
Any suggestions? Thanks in advance.