|
-
Apr 29th, 2001, 11:11 AM
#1
Thread Starter
New Member
How do I bring up Access reports with vb?
I could use a little help.
I have a database in Microsort Access 2000 that has some fairly complex reports. Now I am now building a program in vb 6.0 that uses the same database and I want to use those Access reports.
How can I have vb run Access reports?
Any help would be great!
Thanks for your time,
Don
-
Apr 29th, 2001, 09:36 PM
#2
PowerPoster
For this you have to have a query and a report alreay made!
Make sure all your db connections are closed otherwise it wont work!
Private Sub Command1_Click()
Dim strsql$
Dim wrkJet As Workspace
Dim dbs As Database
Dim qdf As QueryDef
Dim appAcc As Access.Application
Dim pth As String
pth = "DATABASE PATH"
'dao to alter qdf.sql
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase("DATABASE PATH", False)
Set qdf = dbs.QueryDefs("QUERYNAME")
strsql = "SELECT TABLENAME.* FROM TABLENAME HERE WHERE TABLENAME HERE.FIELDNAME =_
#" & Format(Date, "mm/dd/yy") & "#;" 'this part just call all records for todays date! according to a date field! Alter the statement.
qdf.SQL = strsql
dbs.Close
Set dbs = Nothing
wrkJet.Close
Set wrkJet = Nothing
'now open report using access as automation server
Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.RunCommand acCmdAppMaximize
appAcc.OpenCurrentDatabase pth, False
appAcc.DoCmd.OpenReport "REPORT NAME HERE", acViewPreview
End Sub
Hope it helps
-
Apr 30th, 2001, 09:36 PM
#3
Anyone know how????
If you open the Access Report in preview mode, the operator then has access to the rest of the database, other reports, forms, tables, modules etc. Is there a way of going into preview without allowing ....hmm....access to the rest of Access.
-
Apr 30th, 2001, 09:45 PM
#4
PowerPoster
Maybe put a password/workgroup security on the db!
That way when it opens it will ask for the password!
Whcih can be done in vb so you don't get prompted.
And won't let you into any other part except the report!
I'll have a go.
-
Apr 30th, 2001, 11:08 PM
#5
PowerPoster
You can hide the db window in access!
When creating the db. Go to tool>startup> uncheck show db window.
This will stop them seeing it!
Other than that using workgroups works!
-
May 1st, 2001, 07:01 AM
#6
Fanatic Member
A hidden window in Access can be retrieved by pressing F11.
One other solution to this is to create another blank database. Create your report, and have the recordsource point to an external databse i.e. the database the contains your data. Thus, the database contains only one report; no other data.
Of course, the user could go to the report design view to see the source of the data, but then you could close the report/database/workstation using the Report_Deactivate() event. This is envoked once they try to go to design view.
Depend on how paranoid you want to be. In my experience, most users couldn't give a &*^%
-
May 1st, 2001, 04:36 PM
#7
The problem being....
Your right for the majority of users the actual db doesn't hold any interest, but the app l am working on does commission payments and hence needs to be secure.
Anyone got any idea of a superior report writer, (they wont pay for Crystal Reports 8), so have to get an el cheapo one. Cannot use the ones that come with vb cause they sux big time. The version of Crystal does not allow programmatic assigned of database path, even though the property is there
-
May 1st, 2001, 09:02 PM
#8
PowerPoster
Wouldnt adding workgroups.
1 called administrator(you)
1 called others(everyone else)
They are supposedly secured!
So you could set it so when they opened the db in vb they could only see the report nothing else! No design view hidden windows they can't view etc etc.
If not does the User need to see the report or can they just print it?
Because if they can just print it there's no need for them to be seeing the db or report at all!
-
May 1st, 2001, 09:21 PM
#9
The operator wonts to be able to see the report to verify the figures coming off a unix database, i.e Universe date ----- Access Database ------ Access Report, view report, verify sub divisional figures match Universe Inquiry screen. Also she can delete some data and add notes etc.
Maybe l should funnel it out to a Word doc or something?
-
May 1st, 2001, 09:36 PM
#10
PowerPoster
interesting
or maybe view the data in a dbgrid without all the fancy layout etc. That they'd only get that on the printout!
Or use snapshot viewer!
See this:
http://www.microsoft.com/accessdev/a...s/snapshot.htm
would this help?
-
May 1st, 2001, 09:51 PM
#11
Hey thanks Beacon
That would appear to be exactly what l need, and to think it was sitting on a CD all along....duh!
-
May 1st, 2001, 09:57 PM
#12
PowerPoster
No probs!
Now i'm not too sure if you can alter the records! Haven't used it for ages!
Bloody MS always hiding the useful stuff.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|