473,426 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,426 software developers and data experts.

Record Calls to URL in Access Database

63
I set up an Access database with a text field to record the website name and a date field to record the date/time of the access. I have set up a page with various anchors set up to call up different websites. When the user clicks a particular anchor, I want to be able to record this information to the database. Is there an event which can be connected to the anchor and update the database?
Jun 11 '08 #1
5 1806
DrBunchman
979 Expert 512MB
Hi rmurgia,

You could set up an intermediate page between the page you are linking from and the page you are linking to. On this intermediate page you could update the database then forward the user to the appropriate page using a response.redirect.

To do this successfully you will need to pass the URL of the page that the user is trying to link to through the querystring which can be tricky. It would be easier to pass an ID value which you could use to look up your database (where you'll need to store the ID and URL as well as your other data) and return the appropriate URL.

Here's a quick example:

Page1.asp
Expand|Select|Wrap|Line Numbers
  1.  
  2. <a href="LinkClicked.asp?PageID=1">Link 1</a>
  3. <a href="LinkClicked.asp?PageID=2">Link 2</a>
  4.  
LinkClicked.asp
Expand|Select|Wrap|Line Numbers
  1.  iPageID = Request.querystring("PageID") 
  2.  
  3. **** Use iPageID to update your database and retrieve the actual url of the requested page (which i've called sURL) ****
  4.  
  5. Response.Redirect sURL
  6.  
Does this make sense? Let me know how you get on,

Dr B
Jun 11 '08 #2
rmurgia
63
I am trying to store the link the user clicked on in an Access database. I have completed the Access coding which is NOT included below. I have also completed the code to determine the link, which is included below. When the user clicks myAnchor2, http://www.cnn.com is successfully stored since it can be displayed with the document.write command. However, when I try to save it to a text field on the form, it says: document.frmURLHistoryCheck.URLNM is Null or Not an Object. I believe that since we did not click the submit button that URLNM does not yet exist. Is there a way to have say 5 different anchors displayed, and have the user click one of them, determine what the URL was with the code listed below, and then store it to a text field and write it to an Access database? I think what it would have to involve is somehow triggering the submit button from the Javascript and also trigging the vbscript from the Javascript which will save the value in the text field to the Access database. Is this possible?
Expand|Select|Wrap|Line Numbers
  1.  
  2. function FindLink()
  3. {
  4. document.write(document.getElementById('myAnchor2').href);
  5. document.frmURLHistoryCheck.URLNM.value = document.getElementById('myAnchor2').href
  6. }
  7.  
  8. <form method="POST" action="URLHistoryCheck2.asp" name="frmURLHistoryCheck" >
  9.  
  10. <a id="myAnchor2" href="http://www.cnn.com">CNN</a>
  11. <input type="button" onclick="FindLink()" value="Find link">
  12.  
  13. <input type="text" name="URLNM" value="Test">Test Field</input>
  14. </form>
  15.  
Jun 11 '08 #3
DrBunchman
979 Expert 512MB
rmurgia,

I have merged this thread with the previous one you posted as they are on the same subject.

Javascript is a client side language and ASP is a server side language which means that, although your Javascript function knows the URL that has just been clicked, the only way you are able to update the database with that information is to pass it back to the server through a querystring or form. This means that you will have to either link the page back to itself or an intermediate page to process the database update before redirecting to the desired page as per my reply to your original post.

There is no way to update the database without posting the data back to the server in some way.

You could use your FindLink() function to pass the value of the desired URL and redirect to the intermediate page if you prefer rather than following the example I gave above where you stored the URL's in your database.

Dr B
Jun 11 '08 #4
rmurgia
63
I passed to an intermediate page, saved to the database, and then re-directed to the correct page. Thanks for the help.
Jun 24 '08 #5
DrBunchman
979 Expert 512MB
Good stuff! Glad you got it working.

Dr B
Jun 25 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andante.in.Blue | last post by:
Hi everyone! In Access 97, I have a parent form and a subform that are both based on the same query. The main form is continuous and serves up a summary for each record. The subform provides...
17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
4
by: hinrich | last post by:
Hello, I have a completely new system (windows xp prof.), office xp 2002 with sp 3. When I create a new and empty Accesss database, create an empty table and then create a new form using a...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
19
by: rich | last post by:
I am building an app using php and postgresql. My questionis this. How do you handle people wanting to make parallel changes to a record. Since in web apps you are doing a select, bring over a...
9
by: Joshua.Buss | last post by:
I am trying to move a record from one linked table to another within access, but I'm a complete beginner to VBA and don't know exactly where to begin. I have an access file that has the two...
4
by: Jamey Shuemaker | last post by:
Howdy, Saw a couple threads from the past few years on this topic, but didn't really find any solutions. Here's one I found:...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.