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!

Generate report for current record

Status
Not open for further replies.

liltechy

Programmer
May 17, 2002
145
0
0
US
I am creating a database to generate reports based on the current record in another database (table linked via odbc). I have linked the table where the current record would be pulling from, but how do I get the current record to show up in my report? Please help.


liltechy
 
I'm not sure what your question means.

Are you looking at records in a form and you just want to print the one you're looking at?
Or are you processing records in code and trying to print the current record in a recordset?
Or something else?
 
The linked table that I have in Access comes from a PowerBuilder database. When the application(PowerBuilder - AIM) is open and the CSR goes to a specific record, I want them to be able to go into Access and print a report with that current record.

liltechy
 
What you are asking for is well beyond my capabilities - you have to be talking about some sort of application to application messaging, presumably using Windows apis, unless you have some sort of message table built into Powerbuilder which Access can see as well.
 
you can certainly open ms access using command line switches, and have some vba code that looks at the switches and determines which report to run and which 'record' to report on....thus ms access can just serve as a reporting tool... is this what you are after?
 
I have created the report in Access, but I don't know how to (or if it can be done) have the report open to the current record that is open in the Powerbuilder database.


liltechy
 
yes you can... for example, one way is to open MS Access using the shell and pass aurguments (eg recordid for the name of the report to display).

eg the dos command line would look something like:
Code:
"E:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "M:\db4.mdb" /x mcrOpenReport /nostartup /cmd report=MyFirstReport recordid=1

where:
"E:\Program Files\...." = is the path to MSACCESS.exe
"M:\db4.mdb" = is path to your MS Access 'reporting' app
/x mcrOpenReport = tells ms access to run the macro called mcrOpenReport when it opens
/nostartup suppresses accesses opening dialog box
/cmd (and the rest of the text that follow) = a list of command line arugments you wish to 'send' to your reporting app. In this example report=MyFirstReport and recordid=1, where MyFirstReport is the name of the report you want to open and recordid=1 is the record you want the report to show

So, in your MS Access 'reporting' app, you would create a macro called e.g. "mcrOpenReport" which will have the action "RunCode" with the name of your function you want to run when access starts up e.g. OpenCommandLineReport()

Then, in a public module you will have something like:

Code:
Public Function OpenCommandLineReport()
 MsgBox Command
 ' add code to parse teh Command string and open 
   appropriate report at the specified record.
End Function

does this help?

cheers,
dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top