Results 1 to 8 of 8

Thread: report in Access

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Sao Paulo - SP - BRAZIL
    Posts
    65

    Post

    As I do to print a report done in Access that also receives parameters of a consultation from Access, if somebody can send an example I thank

    all using vb , of course

    ------------------
    The blessing of God enriches and it doesn't increase pains

  2. #2
    Junior Member
    Join Date
    Jan 2000
    Location
    Edmonton,AB, Canada
    Posts
    30

    Post

    Try this out. I am not exactly sure what you need but by creating a application object from inside of VB you can manipulate most any part of Access through VB. Here is a snipit of code that I use to change field objects inside Access via VB.

    ' Open up the report to determine what needs to be altered
    Set oAccess = CreateObject("Access.Application.8")
    oAccess.Visible = False
    oAccess.OpenCurrentDatabase (strRepDbms)
    oAccess.DoCmd.OpenReport "PSO VISIT SCHEDULE", acViewDesign

    ' Enumerate Reports collection
    For Each rpt In oAccess.Application.Reports
    ' Search for the first date count field
    For Each tbl In db.TableDefs
    If tbl.Name = tableName Then
    For x = tbl.Fields.Count - 1 To 0 Step -1
    If InStr(tbl.Fields(x).Name, "/") <> 0 Then
    ' Update the LABELS of the report.
    If blnSearchLabels Then
    ' Search for the field that needs changing on the report.
    For y = rpt.Controls.Count - 1 To 0 Step -1
    If (InStr(1, rpt.Controls(y).Name, "T_", vbTextCompare) <> 0 _
    And InStr(1, rpt.Controls(y).Name, "/", vbTextCompare) <> 0) _
    And InStr(1, rpt.Controls(y).Name, " Label") <> 0 _
    And InStr(1, rpt.Controls(y).Name, " Sum") = 0 Then
    "Field Found!rpt.Controls(" & y & ").Name:= " & rpt.Controls(y).Name
    ' Field found.
    blnSearchLabels = False
    Exit For
    End If
    Next y
    End If

    ' Change the field labels for each month.
    rpt.Controls(y).Caption = tbl.Fields(x).Name
    rpt.Controls(y).Name = "T_" & tbl.Fields(x).Name & " Label"


    By applying the same techniques as above you should be able to get to the report and do what you need to do. Best of luck.

  3. #3
    Guest

    Post

    Hmm.. it's looking good.. but does this mean you need to have access at your system?
    Is just a question for Candu.

  4. #4

  5. #5
    Junior Member
    Join Date
    Jan 2000
    Location
    Edmonton,AB, Canada
    Posts
    30

    Post

    Yes you must have access to your Access application; therefore, if the Access application is password protected you need to send the password to Access before you can open up the associated database.


    ------------------
    [/b][/i]David L. Baudais[/i][/b]
    Systems Analyst

  6. #6
    Lively Member FirstKnight's Avatar
    Join Date
    Jul 1999
    Location
    Johannesburg, South Africa
    Posts
    95

    Post

    Candu,

    I think what you want in your signiture is David L. Baudais. *grin*

  7. #7
    Junior Member
    Join Date
    Jan 2000
    Location
    Edmonton,AB, Canada
    Posts
    30

    Post

    Are you sure, eh?

    ------------------
    David L. Baudais
    Systems Analyst


  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Sao Paulo - SP - BRAZIL
    Posts
    65

    Post

    The database is not with password, he has some reports that use consultations also done in ACCESS, THE PROBLEM is THAT THESE CONSULTATIONS HAVE PARAMETERS and I don't know as passing these parameters for the report through VB

    I thank

    ------------------
    The blessing of God enriches and it doesn't increase pains

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