[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

data report

Well,assume there is a employees table(emp.mdb),which contains details of all employees of a particular company.
I want to print a report containing the details of a specific employee,say with employee number 30(empno is the key field of this table) using data report.

further assume that the employee number will b supplied by the user through a text box.there is a command button(cmdprint) in the form, which accepts empno.

My doubt is how to give the sql statmnt inside the command object,so as to print the details of the desired employee?
0
muthu76
Asked:
muthu76
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
mdmurphyCommented:
emoreau,
I have tried to hammer the data report into what I needed it to do, but gave up and made a small investment in Acttive Reports--I have recommended this tool many time here in EE.
Good Luck.
MDMurphy
0
 
muthu76Author Commented:
went to the link suggested by emoreau
and got the answer.
i hav another doubt in this regard.
if there r multiple conditions to b included in the sql,how should it b done?

say, i want a report which contains the details of an employee with id=15 and age > 25?
both r accepted from the user?
how to include it within the sql stmnt,in the command obj of data environmnt?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
chris_aCommented:
I have been playing with these, mainly because I needed async execution. I may have got you answer along the way

I have a complex report that calls a complex SP with parameters, about as bad as it can be.

The code below makes an ADO shaping connection thru SQL server to run a customized ADO/SQL string, asynchronously.

Esentially, modify the connection string and RS source from the data report.

Sorry this is not too clear, but it give you the pointers you need.

########################################

    If deReport.rsGrandTotal.State = adStateOpen Then
        deReport.rsGrandTotal.Close
    End If
   
    If deReport.cnnReport.State = adStateOpen Then
        deReport.cnnReport.Close
    End If
   
    connstr = _
            "Provider=MSDataShape;Data Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=""DSN=" & _
            m_sDSN & ";UID=" & m_sUID & ";PWD=" & m_sPWD & _
            ";QueryLog_On=Yes;QueryLogTime=9000;StatsLog_On=Yes;UseProcForPrepare=0"""
' was
'   connstr = _
'           "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=""DSN=" & _
'           m_sDSN & ";UID=" & m_sUID & ";PWD=" & m_sPWD & _
'           ";QueryLog_On=Yes;QueryLogTime=9000;StatsLog_On=Yes;UseProcForPrepare=0"""
   
    If deReport.cnnReport.State <> adStateOpen Then
        deReport.cnnReport.ConnectionString = connstr
    Else
        If deReport.rsGrandTotal.State = adStateOpen Then
            deReport.rsGrandTotal.Close
        End If
    End If
   
    ' syncronous report
'    deReport.cnnReport.Open
'    deReport.GrandTotal StartDate, EndDate

' async version!    
    sqlish = _
       "SHAPE ( SHAPE {{CALL sp_qryActivationReportAllSites( '" & _
       Format$(StartDate, "dd-mmm-yyyy hh:nn:ss") & "', '" & _
       Format$(EndDate, "dd-mmm-yyyy hh:nn:ss") & _
       "') }} AS qryActivationReportAllSites COMPUTE qryActivationReportAllSites, " & _
       "SUM(qryActivationReportAllSites.'FalseAlarm') AS SumGrpFalse, " & _
       "SUM(qryActivationReportAllSites.'CommsAlarm') AS SumGrpComms, " & _
       "SUM(qryActivationReportAllSites.'IntuderAlarm') AS SumGrpIntruder, " & _
       "COUNT(qryActivationReportAllSites.'Name') AS SumGrpAll " & _
       "By 'SkyCode','Name','Programme_Type') AS qryActivationReportAllSites_Grouping " & _
       "COMPUTE SUM(qryActivationReportAllSites_Grouping.'SumGrpFalse') AS SumAllFalse, " & _
       "SUM(qryActivationReportAllSites_Grouping.'SumGrpAll') AS SumAllAll, " & _
       "SUM(qryActivationReportAllSites_Grouping.'SumGrpIntruder') AS SumAllIntruder, " & _
       "SUM(qryActivationReportAllSites_Grouping.'SumGrpComms') AS SumAllComms, " & _
       "qryActivationReportAllSites_Grouping"
   
    deReport.rsGrandTotal.Open sqlish, connstr, adOpenForwardOnly, adLockReadOnly, adCmdText Or adAsyncExecute
   
    Do While (deReport.rsGrandTotal.State <> adStateOpen) And (m_bCancel = False)
      ' heartbeat indicator
        DoEvents
    Loop
   
    If m_bCancel Then
        deReport.rsGrandTotal.Cancel
        Exit Sub
    End If

    ' put date into a MSHFlexGrid
    '    grid.DataMember = drMain.DataMember
    '    Set grid.DataSource = drMain.DataSource
   
    drMain.StartDate = StartDate
    drMain.EndDate = EndDate
   
    drMain.Show vbModeless

########################################
0
 
chris_aCommented:
I should add that although this is asynchronous, you cannot run two copies of the same report.

I am trying to get round this limitation at the moment. :(
0
 
mdmurphyCommented:
Chris,
This is the last time I will suggest it to you because you have already rejected my answer, but Active Reports will do what you want to do--a whole lot simpler than what I have seen in your other responses. Good Luck anyway.
MDMurphy
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now