Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Access in VB5/6

Status
Not open for further replies.

MrVB50au

Programmer
Mar 16, 2003
326
0
0
AU
Can anyone tell me if it's possible to use a Microsoft Access report in Visual Basic 5.0 or 6.0?

If so, HOW?

 
yes you can

Try this code:
'-------------------------------
Private sub PrintAccessReport()

Const dbPathName = "C:\DB1.MDB"
Dim Acc As Object, db As Object

Set Acc = CreateObject("Access.Application")
Set db = Acc.Application.DBEngine.Workspaces(0).OpenDatabase(dbPathName, 0, False)
Acc.OpenCurrentDatabase dbPathName, False
Acc.DoCmd.OpenReport "YourReportName", acPreview
Set db = Nothing
Set Acc = Nothing

End Sub
'----------------------------------------

hope solve your problem
 
Yes fadlion, Thank you!!

Now, what if you want to do some formatting in runtime for that report, can this also be achieved?

Example:

Instead of using CrystalReports, can one do a fair amount of formatting as in changing a clients photo in VB at runtime, Font changes and style for a specific field at runtime and then when previewing, to see all those take effect?

I know I'm asking a bit here but if you can't give me the answer, could you please direct me to a place to where I can get all this?

I also do have the Microsoft Access Manual if that helps.

Or, can I find this in VB help or Books Online?

Thanks again for your time to help, greatly appreciated.

 
Reformatting Access Report from within vb ....Hmmmmmm

I didn't try it before ,but as first look I don't think that is possible.but for crystal report anything is possible.

goodluck

 
fadloun,

If I ask you then, using Crystal, how would you format a single field (eg: fontname, size etc)?

 
first you should tell me how do u create your crystal report ,are u using CR software or crystal report activex designer.
 
Crystal Software!

Then the ocx on my form1

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top