[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

data report

Posted on 2000-05-07
6
Medium Priority
?
361 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 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