Solved

exporting barcode report to Word

Posted on 2006-07-10
15
343 Views
Last Modified: 2008-02-01
Access 2003/2000
word 2000/2003

Is there anyway to export a report containing barodes to a Word document ?

Thanks
fordraiders
0
Comment
Question by:fordraiders
  • 5
  • 4
  • 4
  • +2
15 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17079208
Hi fordraiders, long time no see

anyways, I assume u know how to export a report write?

DoCmd.OutputTo acOutputReport, "ReportName", acformatertf, "C:\myreport.doc", True


Now is this barcode a image in the report?
What currently happens, do u lose that image?



0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17079333
acformatertf

cant spell, its

acFormatRTF

0
 
LVL 54

Expert Comment

by:nico5038
ID: 17080247
Barcodes are available by a special type of font.
Guess they should stay "visible" using the [W] button for outputting the report to MS Word when the font is available, else I'm afraid you'll have to use a MS Word template and fill that from code....

Nic;o)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:bluelizard
ID: 17080522
this is probably a stretch, but if you like this sort of experimenting and coding, you can build the barcode "manually" by placing lines and/or rectangles onto the report and then use code to make them visible or invisible; this should print o.k.

information about how to build barcodes that represent given numbers can be found e.g. here http://www.barcodeisland.com/symbolgy.phtml


--bluelizard
0
 
LVL 3

Author Comment

by:fordraiders
ID: 17080882
rockiroads,
yep, the image gets lost !
0
 
LVL 3

Author Comment

by:fordraiders
ID: 17080898
rocki, Yes, I know the code,,,,But I can't export the images...correctly.
Or if it can be done

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17081048
Hi fordraiders,

See this link:
            http://support.microsoft.com/?kbid=271622
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17081438
I think perhaps exporting to Word will always lose images, its a limitation I believe. This is probably because the output is RTF format

The only other options I can think of is exporting to Snapshot format or print to PDF

Does it have to be in Word?

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17081759
See this link for a step by step tutorial:

            http://www.wayne.edu/fisops/BARtoew.pdf
0
 
LVL 3

Author Comment

by:fordraiders
ID: 17083883
puppydog, I know how to display them. Its getting them into Word. with the barcode font intact.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 17083897
Rock.
snapshot does fine.., But all people in our group do not have it.
Can I export to PDF , ?? from access .

Thanks
Hope you are doing well...!
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17083930
fordraiders,
the second link I gave you shows you how to export to word, step by step.

               http://www.wayne.edu/fisops/BARtoew.pdf

0
 
LVL 3

Author Comment

by:fordraiders
ID: 17090819
puppy, true, but it has nothing to do with barcodes
0
 
LVL 38

Assisted Solution

by:puppydogbuddy
puppydogbuddy earned 100 total points
ID: 17092231
fordraiders,
Sorry, I must have been half asleep when I gave you that link!

Hopefully, this link will be more helpful:

    http://office.microsoft.com/en-ca/assistance/HA010345341033.aspx
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 400 total points
ID: 17093688
You can dump to PDF, but remember its a printer driver and it will prompt you for a file

But there is PDF995 which prints to pdf and vba code exists whereby u can specify the file to print to so the user never gets the prompt


here is the code


'Read INI settings
Declare Function GetPrivateProfileString Lib "kernel32" Alias _
   "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
   ByVal lpKeyName As Any, ByVal lpDefault As String, _
   ByVal lpReturnedString As String, ByVal nSize As Long, _
   ByVal lpFileName As String) As Long

'Write settings
Declare Function WritePrivateProfileString Lib "kernel32" Alias _
   "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
   ByVal lpKeyName As Any, ByVal lpString As Any, _
   ByVal lpFileName As String) As Long

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub pdfwrite(reportname As String, destpath As String, Optional strcriteria As String)

    ' Runs an Access report to PDF995 to create a pdf file from the report.
    ' Input parameters are the name of the report within the current database,
    ' the path for the output file, and an optional criteria for the report
   
    ' Be sure to check that the "Generating PDF CS" setting in pdfsync.ini is set to 0
    ' when pdf995 is idle. This codes uses that as a completion flag as it seems to be
    ' the most reliable indication that PDF995 is done writing the pdf file.
   
   
    ' Note: The application.printer object is not valid in Access 2000
    ' and earlier. In that case, set the printer in the report to pdf995
    ' and comment out the references herein to the application.printer
   
    Dim syncfile As String, maxwaittime As Long
    Dim iniFileName As String, tmpPrinter As Printer
    Dim outputfile As String, x As Long
    Dim tmpoutputfile As String, tmpAutoLaunch As String
   
    ' set the location of the PDF995.ini and the pdfsync files

'NOTE **** ENSURE THESE SETTINGS ARE CORRECT
    iniFileName = "c:\pdf995\res\pdf995.ini"
    syncfile = "c:\documents and settings\all users\application data\pdf995\res\pdfsync.ini"
   
    ' build the output file name from the path parameter and the report name
    If Mid(destpath, Len(destpath), 1) <> "\" Then destpath = destpath & "\"
    outputfile = destpath & reportname & ".pdf"
   
    ' PDF995 operates asynchronously. We need to determine when it is done so we can
    ' continue. This is done by creating a file and having PDF995 delete it using the
    ' ProcessPDF parameter in its ini file which runs a command when it is complete.
   
    ' save current settings from the PDF995.ini file
    tmpoutputfile = ReadINIfile("PARAMETERS", "Output File", iniFileName)
    tmpAutoLaunch = ReadINIfile("PARAMETERS", "Autolaunch", iniFileName)
   
    ' remove previous pdf if it exists
    On Error Resume Next
    Kill outputfile
    On Error GoTo Cleanup
   
    ' setup new values in PDF995.ini
    x = WritePrivateProfileString("PARAMETERS", "Output File", outputfile, iniFileName)
    x = WritePrivateProfileString("PARAMETERS", "AutoLaunch", "0", iniFileName)
   
    ' change the default printer to PDF995
    ' if running on Access 2000 or earlier, comment out the next two lines
    Set tmpPrinter = Application.Printer
    Application.Printer = Application.Printers("PDF995")
   
    'print the report
    DoCmd.OpenReport reportname, acViewNormal, , strcriteria
   
    ' cleanup delay to allow PDF995 to finish up. When flagfile is nolonger present, PDF995 is done.
    Sleep (10000)
    maxwaittime = 300000 'If pdf995 isn't done in 5 min, quit anyway
    Do While ReadINIfile("PARAMETERS", "Generating PDF CS", syncfile) = "1" And maxwaittime > 0
        Sleep (10000)
        maxwaittime = maxwaittime - 10000
    Loop
   
    ' restore the original default printer and the PDF995.ini settings
Cleanup:
    Sleep (10000)
    x = WritePrivateProfileString("PARAMETERS", "Output File", tmpoutputfile, iniFileName)
    x = WritePrivateProfileString("PARAMETERS", "AutoLaunch", tmpAutoLaunch, iniFileName)
    x = WritePrivateProfileString("PARAMETERS", "Launch", "", iniFileName)
    On Error Resume Next
   
    ' if running on Access 2000 or earlier, comment out the next line
    Application.Printer = tmpPrinter

End Sub

Function ReadINIfile(sSection As String, sEntry As String, sFilename As String) As String
   
    Dim x As Long
    Dim sDefault As String
    Dim sRetBuf As String, iLenBuf As Integer
    Dim sValue As String
   
    'Six arguments
    'Explanation of arguments:
    'sSection: ini file section (always between brackets)
    'sEntry : word on left side of "=" sign
    'sDefault$: value returned if function is unsuccessful
    'sRetBuf$ : the value you're looking for will be copied to this buffer string
    'iLenBuf% : Length in characters of the buffer string
    'sFileName: Path to the ini file
   
    sDefault$ = ""
    sRetBuf$ = String$(256, 0)   '256 null characters
    iLenBuf% = Len(sRetBuf$)
    x = GetPrivateProfileString(sSection, sEntry, _
               sDefault$, sRetBuf$, iLenBuf%, sFilename)
    ReadINIfile = Left$(sRetBuf$, x)

End Function





Regarding snapshot, it comes as part of office, does it not? Then all u need is snapshot viewer and your sorted
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question