Click to See Complete Forum and Search --> : report in Access
Marcelo Velasquez
Jan 19th, 2000, 06:47 PM
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
Candu
Jan 19th, 2000, 08:10 PM
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.
Hmm.. it's looking good.. but does this mean you need to have access at your system?
Is just a question for Candu.
smalig
Jan 19th, 2000, 08:30 PM
Try it: http://vbcode.webhostme.com/en/click.asp?id=84
------------------
smalig
smalig@hotmail.com
http://vbcode.webhostme.com/
Candu
Jan 19th, 2000, 08:43 PM
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
FirstKnight
Jan 19th, 2000, 09:16 PM
Candu,
I think what you want in your signiture is David L. Baudais. *grin*
Candu
Jan 20th, 2000, 11:13 AM
Are you sure, eh?
------------------
David L. Baudais
Systems Analyst
Marcelo Velasquez
Jan 20th, 2000, 05:17 PM
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.