DataReport

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shaiful
    New Member
    • Oct 2007
    • 89

    DataReport

    Hi all, I am using VBA with autoCAD interface, I have included database. However in BVA has no datareport, So how to I include datareport with VBA, Thx advance.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by shaiful
    Hi all, I am using VBA with autoCAD interface, I have included database. However in BVA has no datareport, So how to I include datareport with VBA, Thx advance.
    To output a report in VBA, you can (among other things):
    output as an Access report created report designer
    _______________ _______________ ______________

    DoCmd.OpenRepor t "yourReport ", acViewPreview

    or output and save as a Word rtf:
    _______________ ___________
    DoCmd.OutputTo acOutputReport, strReportName, "c:\Temp\" & strReportName & ".rtf", False

    Comment

    • shaiful
      New Member
      • Oct 2007
      • 89

      #3
      Originally posted by puppydogbuddy
      To output a report in VBA, you can (among other things):
      output as an Access report created report designer
      _______________ _______________ ______________

      DoCmd.OpenRepor t "yourReport ", acViewPreview

      or output and save as a Word rtf:
      _______________ ___________
      DoCmd.OutputTo acOutputReport, strReportName, "c:\Temp\" & strReportName & ".rtf", False
      Hi I make a report by using access and call it in vba code : DoCmd.OpenRepor t "yourReport ", acViewPreview

      one time it was run and i saw report but after that ...............
      its say Run-Time error '2486"
      You can't carry out this action at the present time

      also want to if i send some query from from and add where condition in that case how report will be i mean query data i need to send from "from end"
      Thx again

      Comment

      • puppydogbuddy
        Recognized Expert Top Contributor
        • May 2007
        • 1923

        #4
        Originally posted by shaiful
        Hi I make a report by using access and call it in vba code : DoCmd.OpenRepor t "yourReport ", acViewPreview

        one time it was run and i saw report but after that ...............
        its say Run-Time error '2486"
        You can't carry out this action at the present time

        also want to if i send some query from from and add where condition in that case how report will be i mean query data i need to send from "from end"
        Thx again
        Hi shaiful,
        My reference to "YourReport " was just to give you an example. You need to replace "YourReport " with the actual name of your report.

        Not sure what you mean about sending query data "from end". If you are refering to front-end vs back-end, queries generally are in the front-end. The exception is a query known as a stored procedure, which is designed for server execution and therefore, resides with the server in the back-end.

        Comment

        • shaiful
          New Member
          • Oct 2007
          • 89

          #5
          Originally posted by puppydogbuddy
          Hi shaiful,
          My reference to "YourReport " was just to give you an example. You need to replace "YourReport " with the actual name of your report.

          Not sure what you mean about sending query data "from end". If you are refering to front-end vs back-end, queries generally are in the front-end. The exception is a query known as a stored procedure, which is designed for server execution and therefore, resides with the server in the back-end.
          Hi fisrt thx a lot 4 ur reply, I progress a lot on my project, however i stack only ---
          I have a variavle such as dim Id as integer
          and i want to send ot to database table for query condition where query will be select * from student where S_ID=" & ID & ",

          But i dont know how to i send variables to the DB? Thx again

          Comment

          • puppydogbuddy
            Recognized Expert Top Contributor
            • May 2007
            • 1923

            #6
            Originally posted by shaiful
            Hi fisrt thx a lot 4 ur reply, I progress a lot on my project, however i stack only ---
            I have a variavle such as dim Id as integer
            and i want to send ot to database table for query condition where query will be select * from student where S_ID=" & ID & ",

            But i dont know how to i send variables to the DB? Thx again
            Still not sure what you want, but easiest way to update a table is to turn your select query into an update query, by changing the query type via the query button on the Access command menu, and executing it accordingly.

            By the way your syntax on the select query is incorrect. It should be:

            "select * from student where S_ID = " & ID

            Comment

            • shaiful
              New Member
              • Oct 2007
              • 89

              #7
              Originally posted by puppydogbuddy
              Still not sure what you want, but easiest way to update a table is to turn your select query into an update query, by changing the query type via the query button on the Access command menu, and executing it accordingly.

              By the way your syntax on the select query is incorrect. It should be:

              "select * from student where S_ID = " & ID
              Sorry Still i have a problem about variable with query. i mean how query will know or like with variable from form side?

              Comment

              • puppydogbuddy
                Recognized Expert Top Contributor
                • May 2007
                • 1923

                #8
                Originally posted by shaiful
                Sorry Still i have a problem about variable with query. i mean how query will know or like with variable from form side?
                Ok, if you meant what you said, a variable can not be used directly in a query. What you can do is create a user defined function that references the variable, and then reference the Function in the query....or if you really meant a parameter, you can reference a parameter in the where clause of a query, for example.

                Comment

                • shaiful
                  New Member
                  • Oct 2007
                  • 89

                  #9
                  Originally posted by puppydogbuddy
                  Ok, if you meant what you said, a variable can not be used directly in a query. What you can do is create a user defined function that references the variable, and then reference the Function in the query....or if you really meant a parameter, you can reference a parameter in the where clause of a query, for example.
                  Sorry 4 asking u a lot of Q, Actyally my problem is: i want to show some field on report from table and query will depend on user, such as serach by ID , just give me that idea pls. how query will recognize ID search? , thx again

                  Comment

                  • puppydogbuddy
                    Recognized Expert Top Contributor
                    • May 2007
                    • 1923

                    #10
                    Originally posted by shaiful
                    Sorry 4 asking u a lot of Q, Actyally my problem is: i want to show some field on report from table and query will depend on user, such as serach by ID , just give me that idea pls. how query will recognize ID search? , thx again

                    If you use a query as the record Source for the report, it would look like this:

                    "select * from student where S_ID = " & ID



                    If the S_ID in your report is not bound to the query, you could use the DLookup function to retrieve the S_ID
                    '
                    some control (textbox) in your report:
                    = DLookup("[ID]", "yourTableorQue ry" , "S_ID = " & Report!ID)

                    Comment

                    Working...