ASP Code
  Home arrow ASP Code arrow MS Access to Adobe PageMaker TAGS - By Mic...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

MS Access to Adobe PageMaker TAGS - By Michael Wright
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0
    2001-01-05

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    MS Access to PageMaker (the page make-up software) TAGS - By Michael Wright

    The script below can be modified to retrieve data from an MS Access database and then output the data to plain text format with PageMaker TAGS. This is very useful when exporting data regularly and quickly from databases to save designers time when they’re creating publications, journals etc.

    To use the below script I advise you to have a medium level of ASP knowledge and some knowledge of PageMaker. Cut and paste the code in parts, not forgetting the <% %> TAGS where appropriate. Have FUN!

    First copy the function below which is used for converting database field data to plain text, ridding it of any unwanted HTML codes.

    Function ChangeChars(strToCheck)

    ' Replace unsupported characters e.g. HTML code characters

    strToCheck = Replace(strToCheck, "&#8216;", "'")

    strToCheck = Replace(strToCheck, "&#8217;", "'")

    strToCheck = Replace(strToCheck, "&#8220;", "'")

    strToCheck = Replace(strToCheck, "&#8221;", "'")

    strToCheck = Replace(strToCheck, "&#8211;", "-")

    strToCheck = Replace(strToCheck, "&#160;", "&")

    strToCheck = Replace(strToCheck, "&amp;", " ")

    ' Add any other characters to be replaced here

    ChangeChars = strToCheck

    End Function

    Now we come to the main code. Copy the variable initialization.

    Dim strconn

    Dim conn

    Dim Champtotal

    Dim strSQL

    Dim objFSO, objTextFile

    Dim StartDate

    Copy the database connection setup and modify for your own database.

    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("YOUR DATABASE FULL PATH")

    set conn = server.createobject("adodb.connection")

    conn.open strconn

    set Champtotal = server.createobject("adodb.recordset")

    Copy the SQL query and modify it to suit your needs. Add the WHERE FIELDNAME = '' to query specific fields.

    strSQL = "SELECT * FROM YOUR DATABASE TABLE"

    Copy the open connection statement and also move to the first record of the recordset.

    Champtotal.open strSQL, conn

    Champtotal.MoveFirst

    Copy the code for creating the text file object and text file setup, location, name etc.

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objTextFile = objFSO.CreateTextFile(Server.MapPath("YOUR TEXT FILE FULL PATH"))

    ' E.g. ../output.txt

    Now copy the code for writing the fields and PageMaker TAGS. First you need to add write the setup TAG below.

    objTextFile.WriteLine "<PMTags mac 1.0>"

    Copy the loop below for placing each field you need from the ADO recordset to the plain text file. Each time the loop writes a field to the text file a PageMaker TAG is placed before it. These TAGS are used by PageMaker to automatically format the text. These TAGS should be created in PageMaker to match the ones below which will allow you to preset text to bold, italic, specific font names etc.

    You can change the names of the PageMaker TAGS to whatever you want e.g. from <p1> to <bold> or <headline>. Please remember you need to create the TAGS in PageMaker. It is not like HTML where you have to close the TAGS, the reader simply uses a TAG until it finds the next one.

    Do While Not Champtotal.EOF

    objTextFile.WriteLine "<p1>" + Champtotal.Fields("FIELD1")

    objTextFile.WriteLine "<p2>" + Champtotal.Fields("FIELD2")

    ' To add a date field please use the code below

    objTextFile.Write "<p3>"

    DateFIELD = FormatDateTime(Champtotal.Fields("DateFIELD"),1)

    objTextFile.Write DateFIELD

    objTextFile.Write Chr(13)

    ' End of adding date field code

    objTextFile.WriteLine "<p4>" + Champtotal.Fields("FIELD3")

    ' The code below uses the ChangeChars function. It can be used for all of them if you wish

    objTextFile.WriteLine "<p5>" + ChangeChars(Champtotal.Fields("FIELD4"))

    ' Feel free to add further lines of code to add extra TAGS and fields to the text file

    objTextFile.Write Chr(13) ' This will add a space between the records written to the text file

    Champtotal.MoveNext

    Loop

    Copy the code below to close all objects, recordsets, connections etc

    ' Close the file.

    objTextFile.Close

    ' Release reference to the text file.

    Set objTextFile = Nothing

    ' Release reference to the File System Object.

    Set objFSO = Nothing

    Champtotal.close

    set Champtotal = nothing

    set strconn = nothing

    set conn = nothing

    Copy the code below to finally transport the user to a specific page or to the text file created.

    Response.Redirect("../vetcpd/pagemaker.txt")

    End of code

    I hope the above code is of some use to someone. I happen to think it’s very useful and I have never seen anything like it anywhere.

    Please feel free to send me any comments and if you want to offer me any job vacancies that would be great too - michael_wright@lineone.net!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    IBM – Taking Web 2.0 to Work

    You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Test terminal-based applications with Rational Functional Tester

    Regression testing -- in which code is thoroughly tested to ensure that changes have not produced unexpected results -- is an important part of any development process. But many testing environments neglect the terminal-based applications that still form the backbone of many industries. In this tutorial, you'll learn how the Rational Functional Tester Extension for Terminal-Based Applications works with other Rational Functional Tester to help test terminal-based applications quickly and easily.
    FREE! Go There Now!


    NEW! Trial download: IBM Informix Dynamic Server Express Edition V11.0

    Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data.
    FREE! Go There Now!


    NEW! Using IBM Rational Developer for System z and IBM Rational ClearCase together to manage application development

    Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT