Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Computer Deals
Career Education
Prepaid Phone Card
Televisions
Disney World Tickets
Dental Insurance
PDA Phones & Cases
KVM over IP
Web Design
Domain registration
Home Improvement
Calling Cards
Cell Phones
Holiday Gift Ideas




MySpace Joins eBay, Yahoo in Open Profile Push

News Corp. Unit Under Fire for Ties to Hacker

Are Non-PC Devices Hurting 'Net Innovation?

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Guide to Oracle 11g and Database Migration
Oracle Database 11g includes more features for self-management and automation, which makes it easier for customers to cost-effectively manage their data. Download this Internet.com eBook for an overview of some of the new features in 11g and for an overview of the issues you need to consider as you prepare for a database migration. »
Innovate Faster with Oracle Database 11g
Read this in-depth analysis of 56 customers, which shows significant differences between the value software vendors Oracle and SAP deliver to midsize companies. »
Oracle Business Intelligence Standard Edition One
Find out how Newport Beach, CA-based Mobilitie is shaking up the telecom industry by leveraging technology to provide an entirely different financial model for deploying, upgrading, and owning wireless and wireline network assets. »
Business Intelligence and Enterprise Performance Management: Trends for Emerging Businesses
Quickly implementing an ERP software solution can be of tremendous benefit; however, companies often struggle to balance the benefits of reducing implementation time and cost with the risks of an accelerated deployment. Read this white paper to learn about easy-to-follow best practices for achieving a successful accelerated implementation. »
Making the Case for Oracle Database on Windows
Users benefit as vendors reduce enterprise complexity and deliver integration. »

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
MS Access
January 16, 2004
Navigate Access Forms with Faux Hyperlinks
By Danny Lesandrini

I started this article because I felt like I'd stumbled on a clever way to simulate web browser type hyperlinks on my Access Windows forms and I wanted to share that with readers of Database Journal. However, as is always the case, I began to question my own practice, looking for ways to make it more efficient and extensible. I found one, but in the end, I decided that I liked my original solution better. I'll be curious to see what you think, especially if you have an alternate solution.

Below is an image of the main form in the download for this article. It demonstrates two different methods for exposing links that approximate hyperlinks in an Access form, methods that I refer to as Simple and Complex.

  • Simple Solution: Bind single control to table field, setting its IsHyperlink property to True.
  • Complex Solution: Create an array of labels, dynamically modifying their properties so they behave like hyperlinks.

The action behind the Click event can be anything you want.  In one of my applications, the links point to a table record that stores filter criteria for an imbedded datasheet.  Clicking the link loads the criteria and requeries the datasheet, displaying, for example, the daily report for a given sales rep.  The example above, that comes with the sample code, opens a form that contains the full detail for the given record.  Below, there is an example of how to use this method to allow users to delete a record.  The possibilities are endless.

Simple Solution

I included this solution because I was certain that some reader would write me, saying that Access exposes an IsHyperlink property for controls, making my entire solution irrelevant.  I played with it and here is what I came up with.

Private Sub Form_Load()
On Error Resume Next

   Dim iTotal As Integer
   Dim sMsg As String

   iTotal = DCount("*", "tblItems")
   sMsg = "Total of " & iTotal & "item detail records found."

   Me.lnkItemDetail0.Caption = sMsg

End Sub

Private Sub txtItemDescription_Click()
On Error Resume Next

   Dim strItem As String
   Dim lngItemID As Long

   strItem = Me.txtItemDescription
   lngItemID = Me.ItemID

   DoCmd.OpenForm "frmItem", , , "[ItemID]=" & lngItemID
   DoCmd.MoveSize 100, 6800

End Sub

Now, that was easy, wasn't it.  The advantage of this method is that you can have unlimited links, since the single control is repeated once for each detail record, no matter how many records there are.  You will notice in the screen shot above that the Simple Navigation example indicates 236 item detail records, while the Complex Navigation example reveals only 130 records.  This is due to a limitation of the size of the form, as we will see when we examine the process for the Complex Navigation example.

So, the IsHyperlink trick has two advantages:  it is easy to code and allows for the display of unlimited records.  Why, then, do I still prefer the other method?  Because it allows the developer greater control of the visual appearance of the links and because, in general, hyperlinks are the sort of UI feature that lend themselves to fewer items per page, usually less than 25 or so.  When is the last time you saw a web page with 236 links?

One additional trick was required to make this solution mimic the complex one.  Getting line numbers to display is not a trivial task.  I created a global, public function named GetNextNumber() which returns the ordinal position of the given record.  This is calculated in the query behind the subform and bound to an additional control.

Complex Solution

The code for the complex solution is too verbose to reproduce here, but you can browse it by downloading the code for this article. Basically, the idea is this:

1.      Create an array of labels, naming them lnkItem1, lnkItem2, etc
(maximum of 130 per form, per column created)

2.      Set the OnMouseMove event to =ActivateLink(1), = ActivateLink(2), etc.

3.      In the OnCurrent event for each new parent record, run a routine that resets the following properties:

  1. Label size and location
  2. Label fore color and underline
  3. Label OnClick event

4.      In the OnMouseMove event for each label, run a routine that updates the display:

  1. Label font color
  2. Label underline

This solution is limited to 130 controls because the max height for the detail section of a form is 22 inches.  If you use an 8 point font for the labels and set their heights to 0.1667 inches, you can fit 130 link labels and one header label.  If you use a smaller font or simply scrunch the height, you can fit more, but regardless, there is a limit.  If your UI lends itself to the practice, you could load them in two or more columns, which would double or triple this number, but at this point we are defeating the purpose:  a simple UI.

The code for both events uses the process of looping through all the form controls and manipulating their properties.  I used similar code to assign names, which is included in the download in a module named bas_Utility.

Go to page: 1  2  Next  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MS Access Archives

HP eBook: Using Business Service Management (BSM) to Manage Your Business Applications
Webcast: Five Virtualization Trends to Watch. Produced for HP, Citrix, and Intel.
What's The Future Of IT? Find Out By Reading "IT in 2018" Now. Free Registration Required.
Quest Whitepaper: Improving Oracle Database Performance Using Real-Time Visual Diagnostics
Download: Solaris 8 Migration Assistant. Run Solaris 8 apps on the latest SPARC systems and Solaris 10.


Latest Forum Threads
MS Access Forum
Topic By Replies Updated
Export a report into excel Irina_5220 4 May 9th, 01:50 PM
Table Property Question barlowr70 0 May 6th, 10:51 AM
Compile MS Access Database samson 1 May 1st, 03:28 AM
How to connect MS-Access with c++ rockys111 0 April 30th, 01:36 AM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES