?
Solved

data report

Posted on 2000-05-07
6
Medium Priority
?
357 Views
Last Modified: 2012-08-13
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
Comment
Question by:muthu76
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2785702
0
 

Expert Comment

by:mdmurphy
ID: 2786715
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
 

Author Comment

by:muthu76
ID: 2792022
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.

 
LVL 2

Accepted Solution

by:
chris_a earned 150 total points
ID: 2792170
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
 
LVL 2

Expert Comment

by:chris_a
ID: 2792182
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
 

Expert Comment

by:mdmurphy
ID: 2793080
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question