vb123.com

Garry Robinson's Popular MS Access, Office and VB Resource Site

 

Home  Contact Us
Order our Software


 Smart Access  
The Magazine that Access Developers loved to read and write for is back
Article Index Here or Read More

See 2010 Specials

RSS & Newsletter  
Join our XML/RSS Newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
Read More

Get Good Help
If you need help with a database, our Professionals could be the answer
Read More

  The Workbench  Find out who has your database open, start the correct version of Access, easy compacting and backups, change startup options, mde compile,  shutdown database Read and Download

Access >>> SQL 
Upsize to SQL Server 2005 or 2008, easily repeated conversions, highly accurate SQL query
translation and web form conversion.
Read More

 Is Your Database Corrupt ?
If you have a corrupt database, Try our Access Recovery service

The Toolbox
Libraries of software that we regularly import into our projects. This is a newer version of the Toolshed More..

SharePoint
For our company file sharing and task management, we use
SharePointHosting


Datamining/Graphs

Explore your data with this versatile graphing and data mining shareware tool.  Read More

DryToast 
Backup and query your BaseCamp
® projects
Read More

Garry's Blog
Find out a few other things that Garry has been writing about Microsoft Access. Read more

Like FMS Products?
Purchase them from us and get a free Workbench or Toolbox  More

About The Editor Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia
Contact Us ...

Search ...

or try our new site built with SharePoint Designer
 vb123.com.au
 

 

Next Tip    Projecting Your Partners Online Image

By Garry Robinson

Introduction

One of the projects that I was involved in was for a  provider of wholesale merchandise to a wide range of large companies. All of these items were branded with the clients logos and marketing slogans and therefore were only viable as items sold to their customers.   When we had to take this business model online, we basically had to promote retail companies and their products in an way that suited their web sites. So the online challenge was to mimic the look and feel of each individual web site and supply all the relevant merchandising data and images from our database.   This article uses Active Server Pages to show you how you might achieve this on your web site.

The Demonstration Downloads.

For this article, I used the demonstration data from a Q & A section that I wrote for Pinnacles Smart Access magazine.  That discusses how you can manage external pictures in an Access Database.  The database, ASP files and images are all included in functional directory structure.   There is a readme file that explains how to set it up.  To see a demonstration of this software in action, go to http://www.gr-fx.com/asp/  and select the demonstrations on the left hand side. 

The Entry Page Establishes The Retailers Personality

The first task in establishing a retail personality was to provide the retailers with a unique method by which they can point to your Web Site.   The method I used was to direct them to a specific ASP directory on the web site where the company identifier is established.   The link from their web site would point to a default.asp page as follows

www.myweb.com/acme/

In this directory, I store two standard images with the obvious names of TopCentre.GIF and BackImage.GIF.   These will be to project the retailers image through the site.  This entry page can also be used to provide information on how to use the site.  Initially though I establish the unique Company identifier called "CID" using a session variable

<%Session("CID") = "Acme"%>

The start page displays these images for the first time and the user then enters the normal part of the site using a standard html reference link

<body background="backimage.gif">

<p align="center">

<img src="topcentre.gif" alt="Acme Products"></p>

<a href="../default1.asp">Enter Here</a></p>

The First Shared Pages

The user now enters the main page in the site called Default1.asp and the first task is to establish the retail company identity.   This is done by checking that the session variable has been set.  This is not always the case because it might have expired or the user may have entered the site using a browser favorite setting.   Either way, if it exists,  I set a local variable or redirect the user to a warning page if it does not exist.  

<%' Establish The Company Identification

if len(Session("CID")) > 0 then

  comp_id = Session("CID")

else

  comp_id = Request.QueryString("Comp_id")

  Session("CID") = comp_id

end if

if len(session("CID")) = 0 then

'  Session has expired or comes from an unknown site

   response.redirect "expired.htm"

end if  %>

The Second Way To Establish The Retail Company

In the listing above, I use the Request.QueryString function to retrieve the company identifier if it has been passed from another form using a hyperlink as follows.

<a href="default1.asp?Comp_id=Acme">Click Here</a></p>

I found it was necessary to cater for this second technique because the CGI that we used for email posting had a redirection command that meant that the a new session was established.   Therefore the company session variable was reset .  So I added the company id to the hyperlink where the email was posted and the redirection returns to this page where it is handled as a query string.  You can certainly use this as an alternative way to establish the retail companies identity but the ASP entry page will offer more flexibility in the long run.

Only Show The Retailers Information

Apart from customizing the interface for the retailer, it is very important that you only display the products that want you to display.  This applies both to the individual products and if the products are grouped into categories, only show those categories that have some information.  To enable this flexibility, I setup a joining table called CompanyProducts where I store the product and retailers id's.  The data model for this is shown in Figure 1.

Figure 1 - Use A Joining Table To Link Retailers To Products

This new table forms the basis of the customized views of data and information for each company only is added when the company wants to go online.   For the queries that are run in ASP pages, I find it easier to test and store all the queries in the database rather than as complicated SQL in ASP pages.  Storing queries in the data only Access database is quite unusual as Access usually operates by storing all the queries in the front-end software database.  This can lead to some redundancies as queries will exist in Access in both the front-end software and the backend database. 

The ASP code that is used to setup the record sets for the categories is noteworthy because of the filtering by company ID and because the Image reference is actually computed on the fly in the Access Query

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "dsn=grfx"

SQL = "SELECT distinct CategoryID, CategoryName, imageRef"

SQL = SQL & " FROM webCategories where"

SQL = SQL & " companyid='" & comp_id & "'"

Set RS = Conn.Execute(SQL)

The Access query called WebCategories is a multi joined affair with the images being stored in the /IMAGES directory using the category name for the GIF file.   A portion of the SQL stored in the Access database is shown

"images/" & [categoryname] & ".gif" AS imageRef

This method of referencing the external images is demonstrated in the Access database or you can read the theory at   http://vb123.com/toolshed/99/externalimages.htm

Customizing The Actual ASP Form

The first steps in the retail customization are to change the title and to then load the top image and the background image using an include file.  When researching this include files, there were a few references on different sites to renaming the include files with an ASP extension for security reasons.  In this instance, the include file does not hold critical coding information so the extension stays as is.

<title>Welcome From <%=Comp_id%> - Tasty Products On The Web</title>

</head>

<!--#include file ="../asp/tophtml.inc"-->

The include file is as follows

<body background="<%=Session("CID")%>/backimage.gif">

<p align="center">

<img src="<%=Session("CID")%>/topcentre.gif"

alt="<%=Session("CID")%> Products" ></p>

The rest of this form simply displays the category pictures and has a hyperlink to the products form as follows

<a href="products.asp?CategoryID=

<%=rs("CategoryID")%>">

Display Only The Retailers Products

The second form called Products.asp will look the same as it incorporates the same include file.  

<!--#include file="../asp/tophtml.inc"-->

The products are selected again by filtering on the company ID from a database query as follows.  Noteworthy in this query is that it is easier to store the formatting in the actual query itself rather than handle it in the ASP file.   Also you can see here how the inner-join allows you to assign the products to a given company.

SELECT CompanyProducts.CompanyID, Products.*,
Format([UnitPrice],"Currency") AS WebUnitPrice
FROM Products INNER JOIN CompanyProducts
ON Products.ProductID = CompanyProducts.ProductID;

Adding A New Retailer

If you wished to add a new retailer called Gudday Mate Food Products, the steps are as follows

·         Add a retail company record including a code to identify the company  e.g. GDMT

·         Add the CompanyProduct records

·         Add a new folder called  /GDMT

·         Add a background and topcentre image to this folder

These steps can all be completed by non programmers.

A Third Way To Establish The Retailers Identity

In a separate form called Default2.htm, I utilize a different method to define the company identification in the ASP page.  This uses the server variables method to extract the site name from the page that the user last came from or typed in before visiting this page.   This technique would work particularly well when used in conjunction with sub-domains such as  http://acme.myweb.com/

<% ' Establish The Company Identification

   refsite=request.servervariables("http_referer")

'  Check for the reference site

   if left(refSite,17) = "http://acme.myweb" then

     Session("CID") = "ACTF"

   else

'     Session has expired or comes from an unknown site

     response.redirect "expired.htm"

   end if

Other Ways To Customize The Settings

Once the company id is established, you could retrieve all the web settings such as color of web page, return email and web address, contact phone numbers for the retailer by querying your database.  In my project, I use customized greetings to personalize the site a little more.  

Not Everyone Loves Frames But  !!

The technology of sharing with different companies tend to work better with framed pages at the retailers site because

·         you have less work to do to generate a professional looking site 

·         frames tend to hide the actual web address from the end user so that they can be further encouraged that they are actually on the retail companies web site. 

·         the framed page allows most of the corporate imagery to be handled on the retailers site.

Summary

Irrespective of whether your sales model is multi tiered or you want people to use your information, helping your partners by projecting their image online is only going to encourage them to work with you  !!!

Author Bio
Garry Robinson runs a software development company called GR-FX based in Sydney, Australia.  Recently he has written a number of articles for other Pinnacle magazines on topics such as Consolidating Data Using Queries, Manipulating MS Graph with Access, using MSChart in VB and using Access to Automated your E-mail.  He developed a popular shareware data mining tool that will allow you to drilldown on data in any linked backend database and then to visualize that data in 2 or 3D using MS Graph. He also runs a programmers resources page  at  http://www.gr-fx.com/ when he is not out snorkeling or hitting golf balls.    Contact details access@gr-fx.com    ph +61 2 9665 2871

 

Open the articles download files by clicking on this picture Full Download Database In GR-FX Resource Kit  You will need to own a copy of The Toolshed to have access to these files.   See the readme file for installation instructions. 

Click on this button Next Tip to head to the next page in this loop

This tip was written by Garry Robinson from GR-FX Pty Limited in Sydney, Australia.

 

Links >>>  Home | Search | Workbench | Orders | Newsletter | Access Security | Access professionals