Convert a string value in a Query to a hyperlink

kfschaefer

Registered User.
Local time
Yesterday, 23:20
Joined
Oct 10, 2008
Messages
58
I am attempting to create a function that will convert a record id in a query to display a hyper link value.

Not sure if this can be done. What would be the correct syntax to change the RecId in the query that will inturn be exported to an HTML output.

Would the newly created hyper link remain a link once outputed to the HTML file?

Would I have to create a table first for the hyperlink to remain?

I would like to include a hyperlink value of the record ID so that when the user clicks the link the user will be directed back to the database and its record. I found code that will allow the Command() function to read this hyperlink, however, I first must convert the RecordID to the correct file path.

K

Public Const strLink = "\\path1\path2\EmergentWk\EmergentWork.mdb"

Function HLink(nseq As String)ss hyperlink
gFP = strLink & "/cmdID= " & gID & ""
HLink = gFP
End Function
 
I am attempting to create a function that will convert a record id in a query to display a hyper link value.

Not sure if this can be done. What would be the correct syntax to change the RecId in the query that will inturn be exported to an HTML output.

Would the newly created hyper link remain a link once outputed to the HTML file?

Would I have to create a table first for the hyperlink to remain?

I would like to include a hyperlink value of the record ID so that when the user clicks the link the user will be directed back to the database and its record. I found code that will allow the Command() function to read this hyperlink, however, I first must convert the RecordID to the correct file path.

K

Public Const strLink = "\\path1\path2\EmergentWk\EmergentWork.mdb"

Function HLink(nseq As String)ss hyperlink
gFP = strLink & "/cmdID= " & gID & ""
HLink = gFP
End Function

I have absolutely no idea of what you are talking about.


Where do you expect to display this hyperlink? On a form? In a html file on disk?

If you want to dispaly it an HTML file, then you can use VBA code to open a textfile (saved with an .html extension) and then write the HTML syntax to the textfile.

If you need to retrieve the recorrd ID from the database, you can use a recordset to do that, and then move the value from the recordset into your HTML string, and then, finally, write the HTML string to the textfile. Do you know enough HTML to do this? (I don't know any HTML, but I dabbled in it once, a few years back).
 
Sorry for the confusion,

I am trying to give my users an Email notification that there has been a change to certain records. My current process sends and email w/attachment(html). I was hoping to include a link on the record id that will direct the user back to the Access Database and open the specific record.

However, I am having difficulty including the link back to the database - that will open the database then Open of the startup form capture the Command() so that the user opens the correct form and the correct record.

HOpe this explains it better,

Karen
 
Sorry for the confusion,

I am trying to give my users an Email notification that there has been a change to certain records. My current process sends and email w/attachment(html). I was hoping to include a link on the record id that will direct the user back to the Access Database and open the specific record.

However, I am having difficulty including the link back to the database - that will open the database then Open of the startup form capture the Command() so that the user opens the correct form and the correct record.

HOpe this explains it better,

Karen

This sounds to me like you want to pass in a command line argument to Access except that the web browser will have to execute the command (i.e. run MsAccess.exe) and pass in the argument (presumably the record ID). I'm not sure whether an html link allows for passing in command line arguments. To research this, try googling for "passing command line arguments to MsAccess" or maybe "passing command line arguments using HTML". Here's a couple of links I found:


http://www.dbforums.com/archive/index.php/t-291105.html

http://office.microsoft.com/en-us/access/HA101666051033.aspx

Maybe I'll try this myself.
 
As far as opening up the "correct form" that's a tough one. You'll be more likely to succeed if the database automatically loads the form at startup. Can't you just designate a particular form as the startup form?
 
I doubt HTML provides much support for command line arguments. Anyway, in case you don't know the syntax for proving a link to an MDB file, let's assume you have northwind on the Cdrive:

<a href="file://C:/Northwind.mdb"> Click Here to Open Northwind </a>


If you paste the above into a textfile and save it with an HTML extension, the use should be able to click the link to open the Northwind database.
 
Then again, I just remembered that HTML, as i recall supports scripting. Using VBscript, i suppose you could run the Shell command, which is likely to accept command line arguments.
 
Maybe I'm getting closer to command line arguments. Here's a vbscript that opens an MDB file.



<script language="vbScript">
<!--
Dim wshShell, dblQuote, exe
exe = "c:\Program Files\Microsoft Office\OFFICE11\MsAccess.exe"
dblQuote = """"
exe = dblQuote & exe & dblQuote
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run exe & " c:\Northwind.mdb", 1, True // -->
</script>


I think this goes in the Body of the HTML page. Not sure. But it worked, anyway. If your mdb path has any spaces, you would need to wrap it in dblQuotes as well.
 
Ok, one of the articles I gave you said that you can add the parameter /cmd to the command line as to pass in a desired value. I think if you add that to the string I provided above, it should work. Let me know how it goes.
 

Users who are viewing this thread

Back
Top Bottom