Results 1 to 11 of 11

Thread: Printing a DBGrid

  1. #1

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Question

    Is there anyway of printing a DBGrid with line's and headings and content, at present I am sending the information to a RTB and printing from there not very good as the content gets out of shape etc

    Cheers

    Spud

  2. #2
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Lightbulb Chrystal report

    I don't know how to print a dbgrid directly to the printer, but can't you print it with crystal reports?

  3. #3

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Unhappy

    Red Thread, I'm new at this can you help on the crystal reports ive found it in VB but havent a clue what to do!
    Does it let you print off reports in your application that you have made or does it just allow you to print reports within crystel report itself?

    Spud

  4. #4

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Red face

    Sorry Red, read up on crystal reports just the thing I need sort off, question the reason i was trying to print the dbgrid was because it contained a search result in it is it posible to do this with crystel reports

    Cheers

    Spud

    (going to post this as a new thread)

  5. #5
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Talking It can be done

    The looks stay the same, but the amound of data you're send to this report, depends from your program.

    ex. with a search in your database you come up with 2 records of data. When you hit the print button, you're chrystal reports will print only this 2 records of data. With your next search, you find 9 records. When you hit the print button, you only can print this 9 records.

    When i have time i'll send you a little example.

    I'm self a newbie VB programmer, but i know this works because i've programmed this once.

    Greetings !

    TIP : Make sure you have ANY printer on your system installed. Otherwise CR will not show you the data to print in runtime. You must have installed a printer.

  6. #6

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Wink

    Cheers Red
    Im going to log of now and give it a try and I will get back to you thanks for helping out!



    Spud

  7. #7
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Thumbs up Read This...

    Ok, lets start....

    1) make your report the way you want... BUT when you save, DON'T select the "Save data with report". Your report may not contain data. Whe are going to do that...

    2) How? Well, send your sql string along !
    In the code below you see how is it done. In my sql i state that i will have all artikels where the name the same is as the one in my textbox.

    report1.ReportFileName = App.Path & "\detailreport.rpt"
    report1.SelectionFormula = "{ARTIKELS.AT_NAME} = '" & txt_name.text & "'"
    report1.PrintReport


    With this you normally have everything you need to know.

    Good luck.

  8. #8

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Unhappy

    Sorry to be a pain Red but can you look at this:


    CrystalReport1.ReportFileName = App.Path & "\RecruitSG\new.rpt"
    CrystalReport1.SelectionFormula = "{LastName} = '" & Text1.Text & "'"
    CrystalReport1.PrintReport


    Nothing happens, I dont realy understand the SelectionFormula bit of the code could you help?

    Report file: new.rpt
    Search textbox: text1.text
    Colum to search: LastName
    Data Control: data1

    Thanks again


  9. #9
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Wink Euhh...

    Look fine at first look, but it will be usefull i've you send me you project. So i can look in detail myself.

    I see you only use lastname, but you must write the databasetabel also. ex tabel1.lastname



  10. #10

    Thread Starter
    Fanatic Member spud's Avatar
    Join Date
    Aug 2000
    Location
    Munster (Germany)
    Posts
    542

    Red face Your correct!!!

    Thats what was wrong I didnt put the table name in but its working fine now, I hope one day I can return the help Red as this has helped me out a grate deal.


    Once again thanks!

    Spud




  11. #11
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Wink

    No thx...

    pleasure to help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width