Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a database \ form from a HTML link in a e-mail

Status
Not open for further replies.

Oliver2003

Technical User
Apr 19, 2003
144
GB
I was just wondering if anyone knows if it is possible to open a database from a HTML link in a e-mail or even better a form in that database????????
 
Absolutely!

First, your recipient must have an email browser capable of receiving hyperlinks (Outlook 98 and up or Outlook Express 5 and up should be able to). Second, the hyperlink must specify a path that the recipient can access. Third, the recipient must have MS Access on his computer. Fourth, the recipient must have the .mdb extension set to open with MS Access.

Just type the full path and database name into your email text in UNC format. For example:

\\prodcomp\d$\maindatabase.mdb

When the user clicks on the hyperlink he will be shown the standard open/save dialog box. If he chooses open the database will open up.

As far as automatically displaying a form when the database is opened, in the Access Tools menu there is a Startup menu item. If you click on this the Startup dialog box appears. Put the name of the form you want to display in the Display Form textbox and uncheck the Display Database window.


[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
If using Access 2000 or 2002 you could create an Access Data Access Page that users can run in IE, even if they don't have Access, but they need the MSOffice Web Components. If the form isn't too complex you can try just saving as ADP and then modify to your needs.

If going the file:///\\server\share\db.mdb route just you can also create macro named "autoexec" that opens a specific form when the database opens.
 
ks for the replies,

wemeier I am not familiar with html - what is unc format
if I wanted to open database.mdb in c:\ how would the code look? (\\prodcomp\c$\database.mdb)

My database already has a main form that loads when the database is opened - I was wondering if it was possible to open another form in the database from the html link?

Thank you
 
UNC format means using the name or IP address of the computer on which the database resides in the path. \\prodcomp\c$ means the C drive on the computer whose computer name is prodcomp.

As far as opening an alternate form, you could create a shortcut to your database and include /Xmacroname to the command prompt where macroname is the name of a macro that opens your alternate form. As long as your shortcut was created using a UNC name for the database, you can email the shortcut. When the user clicks on the shortcut, it will open the database and execute the macro.

[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
Thanks for your help - I'm going to give it a try on monday
 
I have tried the above methods but do not seem to be able to get them to work - I just get plain text in the e-mail not a clickable link?

I am creating the e-mail using outlook and access 97 with the sample of code below:


txtMessage = "\\prodcomp\d$\maindatabase.mdb"

With MailOutLook
.To = txtTO
.CC = ""
.Subject = txtSubject
.HTMLBody = txtMessage
.Send
End With

This works fine but it is just giving plain text - Do I need to add any headers to txtMessage?

Thank You
 
Sorry, I didn't realize that you were generating the email from Access. If you entered the same information manually into an email, Outlook would convert it to a hyperlink. I don't know if you can actually imbed a hyperlink.

[shadeshappy] Cruising the Information Superhighway
(your mileage may vary)
 
Could be you need to enter the hyperlink in a HTML format.
Try setting this:

txtmessage = &quot;<html<body><a href=\\prodcomp\d$\maindatabase.mdb>Click here</a>&quot;

Paul
 
Thanks for that Paul - I just foud that from looking at the source code from internet site - I found

txtmessage = &quot;<A HREF=\\prodcomp\d$\maindatabase.mdb STYLE=text-decoration: none>open</a>

which does the same as yours, but removes the underscore
 
I have a question about hyperlinks as well.

I have an Access 2002 database full of Book titles which have 10 digit ISBNS. I have a search form that queries the database for a specific book & displays the results in a query.

Heres what I want to be able to do:

1) I want to make the ISBN field display as a HYPERLINK
2) Then when I click on it, I want Access to insert that ISBN number into this web address in place of 0781401747 :

As you can see on the link at the bottom, whatever ISBN is inserted, then that link will bring up the corresponding book on Amazon's site.

Basically, How do I link up Access to Amazon with a single click from my database?
How do I create the statement that takes

( + (ISBN) + (/qid%3D1051886198/sr%3D11-1/ref%3Dsr%5F11%5F1/102-4251222-6130551) and then make this statement a HYPERLINK?

Thanks in advance for your help!

 
gbs01

Look in the Access help. E.g.,

Hyperlink Property Example

The CreateHyperlink procedure in the following example sets the hyperlink properties for a command button, label, or image control to the address and subaddress values passed to the procedure. The address setting is an optional argument, because a hyperlink to an object in the current database uses only the subaddress setting, To try this example, create a form with two text box controls (txtAddress and txtSubAddress) and a command button (cmdFollowLink) and paste the following into the Declarations section of the form's module:

Private Sub cmdFollowLink_Click()
CreateHyperlink Me!cmdFollowLink, Me!txtSubAddress, _
Me!txtAddress
End Sub

Sub CreateHyperlink(ctlSelected As Control, _
strSubAddress As String, Optional strAddress As String)
Dim hlk As Hyperlink
Select Case ctlSelected.ControlType
Case acLabel, acImage, acCommandButton
Set hlk = ctlSelected.Hyperlink
With hlk
If Not IsMissing(strAddress) Then
.Address = strAddress
Else
.Address = &quot;&quot;
End If
.SubAddress = strSubAddress
.Follow
.Address = &quot;&quot;
.SubAddress = &quot;&quot;
End With
Case Else
MsgBox &quot;The control '&quot; & ctlSelected.Name _
& &quot;' does not support hyperlinks.&quot;
End Select
End Sub


Judge Hopkins


There are only two rules for success: (1) Never tell everything you know.
 
Related but different question:

Has anyone had trouble getting a hyperlink to actually open the Access database after clicking &quot;open&quot; instead of &quot;save&quot; in Windows 2000/Access 2000?

Thanks,
C



*~*~*~*~*~*~*~*~*~*~*~*~*
Insanity is a matter of Perception. [yinyang]
 
Paul,

When I click the hyperlink I get the &quot;open or save&quot; box. I click &quot;open&quot; and briefly see what looks like a downloading dialoge box flash on the screen (it's too quick to see any words). Then nothing. If I check Task Manager I see an Access Process running, but the application isn't visible or showing up in the Applications tab of Task Manager.

I can't get the database to actually OPEN from the hyperlink. It seems very strange and I'm totally baffled.

Thanks,
C

*~*~*~*~*~*~*~*~*~*~*~*~*
Insanity is a matter of Perception. [yinyang]
 
As a follow-up... when I have the DATABASE on my C drive it works perfectly well. So, any thoughts on what our network might be doing to block the Database from launching?

Thanks!
C

*~*~*~*~*~*~*~*~*~*~*~*~*
Insanity is a matter of Perception. [yinyang]
 
Further research reveals... if I have a DB to the web server and there is NO CODE I can open it from a hyperlink just fine, BUT, if there is even a single line of code (docmd.maximize) the DB will NOT open.

Does this help identify what restrictions might be imposed by our network? Or is this actually a limitation to opening an Access database via a web hyperlink?

Thanks,
C

*~*~*~*~*~*~*~*~*~*~*~*~*
Insanity is a matter of Perception. [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top