Solved

data report

Posted on 2000-05-07
6
346 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
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 2

Accepted Solution

by:
chris_a earned 50 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access Product Inventory Movement Transfer Form With Separate Records Combined Into one Form 55 96
Microsoft Access combo box help 2 52
vbModal 12 66
Excel Automation VBA 19 104
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

726 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