Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data report designer - user input at run-time

Status
Not open for further replies.

dwray

Programmer
Jul 24, 2002
4
CA
I have created 2 seperate reports using the data report designer. The source for both reports is a data environment connected to a MS Access table. The first report works fine. It is a simple report (no grouping) that lists records from the table entered by the currently logged in user and a date range the user inputs. I acheived this by changing the command text of the data environment command:

Private Sub cmdPrint_Click()

ToDate = txtTo.Text
FromDate = txtFrom.Text

sqlSelect = &quot;SELECT * FROM tblCallDetails WHERE UserID = '&quot; & sUserID & &quot;' AND CallDate <= '&quot; & ToDate & &quot;' AND CallDate >= '&quot; & FromDate & &quot;'&quot;

With deCallTrackingReports.Commands(1)
.CommandText = sqlSelect
.Execute
End With

drCallOutcomeDetails.show

End Sub

My problem is with the second report. I would like this report to list all records in a given date range regardless of the current user, however the report must be grouped by userID. I created the report with the grouping level and it works fine, however, when I duplicate the above code (without the userID WHERE criteria) so the report will only display records in a date range I keep getting an error message stating 'DataField cmdBlah.userID not found'. I suspect this has to do with the fact that I have added a grouping level of userID which creates a new command name (cmdBlahblah grouped using cmdBlahblah_grouping) and vb doesn't recognize the command object I am referring to.

I guess my question is: is there a way to change the command text of a grouped command? Is there another way to retrieve records in a data report based on user input at run-time?

Sorry for the length of this message. Any help would be appreciated. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top