|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Text Boxes
What is the best way to send text box information straight to an Access report for printing without using a database?
|
|
#2
|
|||
|
|||
|
What do you mean by send to an access report without using a database? You can send text directly to a printer from VB, or call up the printer dialog.
|
|
#3
|
|||
|
|||
|
I have a report that is done in Access with labels and graphics. I want to populate the details section of the report with the information in the text boxes. I can temporarily save it to the database, but then I would just have to delete the records once it is printed. I don't need anything but a printed record of the text box information. Also, can I use the VB Report Designer without making a Data Enviroment connection instead?
|
|
#4
|
|||
|
|||
|
I think u need use the Data Enviroment connection to save data to access..
|
|
#5
|
|||
|
|||
|
Thanks. I don't want to save my info in the database if I don't have to, just print it from an Access report. The Access report looks the best. After the report is printed, I do not need the information, so it doesn't seem like a good idea to save the data to the database and then delete it all. It isn't a good programming technique.
|
|
#6
|
|||
|
|||
|
I suppose you could use VBA code in the report to grab the textbox information, assuming you call the report from a button on a form or something similar. I haven't done this but it should be doable, the report can have an underlying VBA code page.
|
|
#7
|
|||
|
|||
|
Printing and Viewing Access Reports (VBA)
This code enables you to specify a Microsoft Access database open a report and print it out or open in preview form through Visual Basic. Create a module and place the following inside: code:--------------------------------------------------------------------------------'Code written by Ryan Wischmeyer 'This code is intended for educational use 'and may not be implemented into projects 'which are to be sold for retail value. Option Explicit ' In other applications like Microsoft Visual Basic, ' you can include a reference to Microsoft Access to ' gain the use of Access constants. Or, use the following ' constant values... Global Const acNormal = 0 Global Const acDesign = 1 Global Const acPreview = 2 ' ----------------------------------------------------- ' Application Quit options... ' saves all objects without displaying a dialog box: Global Const acSaveYes = 0 ' displays a dialog box that asks whether you want to save any ' database objects that have been changed but not saved: Global Const acPrompt = 1 ' quits Microsoft Access without saving any objects: Global Const acExit = 2 Sub PrintAccessReport(dbname As String, rptname As String, preview As Boolean) Dim objaccess As Object On Error GoTo PrintAccessReport_ErrHandler Set objaccess = CreateObject("Access.Application") With objaccess .OpenCurrentDatabase filepath:=dbname If preview = True Then 'Preview report on screen. .DoCmd.OpenReport reportname:=rptname, View:=acPreview .Visible = True .DoCmd.Maximize 'maximizes the Report window .DoCmd.Maximize 'maximizes Access window Else 'Print report to printer. .DoCmd.OpenReport reportname:=rptname, View:=acNormal DoEvents 'Allow report to be sent to printer. End If End With Set objaccess = Nothing Exit Sub PrintAccessReport_ErrHandler: MsgBox Error$(), , "Print Access Report" End Sub-------------------------------------------------------------------------------- Now Call this procedure with a command button or whatever replacing the example below with the desired parameters. The first parameter requests the path to the database, the second requests the Report name, and the third requests the view state: True will open access and display the report, False will just print the report. code:--------------------------------------------------------------------------------Call PrintAccessReport App.Path & "collectables.mdb", "Figures", True |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Text Boxes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|