Source language: Translate to:

How to Run MS-Access Report via VBScript

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

How to Run MS-Access Report via VBScript

Postby David de Argentina » Mon Nov 29, 2010 4:46 pm

Hi all,

This function allow to NeoBook calls to a MS-Access Report.
It has 2 parameters
[%1] = Database Name
[%2] = Report Name

the code of the function is the following

Code: Select all
Dim oAccess, db, report

const acQuitSaveNone = "2"
const acViewPreview = "2"
const acViewNormal = "0"
const acOutputReport = "3"
const acSendReport = "3"
const acFormatRTF="Rich Text Format (*.rtf)"
const acFormatXLS="Microsoft Excel 97-2002 (*.xls)"
const acFormatSNP="Snapshot Format (*.snp)"
const acFormatHTML="HTML (*.html)"

db = "[%1]"
Report = "[%2]"

Set oAccess = CreateObject("Access.Application")
oAccess.Visible = False
oAccess.OpenCurrentDatabase db

With oAccess.DoCmd
.OpenReport Report, acViewNormal
.close
.Quit
end with
Set oAccess = Nothing



This sample works with the NorthWind sample database (NWind.mdb)

you could download it from:

http://www.mediafire.com/file/h6y1w3b3h7vxftq/NWind.pub

Enjoy it !

David de Argentina
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Postby eddy current » Mon Nov 29, 2010 8:51 pm

Thank you for sharing David.

Quick question: Which versions of Access have you tested this with?

Thanks -- Glen
eddy current
 
Posts: 48
Joined: Mon May 23, 2005 7:24 pm

Postby David de Argentina » Mon Nov 29, 2010 11:30 pm

I tested on Access 2003.

I think this function may work on Access 2000 or newer.

My devaluated cent,

David de Argentina
User avatar
David de Argentina
 
Posts: 1560
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

cron