Manu310
Manu310

Reputation: 168

Insert Hyperlink in Access Database (pyodbc)

Here is the situation: I'm 'having fun' really using Microsoft Access for the first time for small personnal project/tools ideas.

I don't know anything about VBA yet, and unless I can't do without it, I don't plan to learn it this time (already a lot else to cover).

So I tried to use Python to automatize the main table filling. I did find pyodbc package and succeeded to connect, read and write some data out of my database. However, I wanted to experiment a little further, and one of the fields could contain hyperlinks (could be handled somewhere else in another script later, but I am curious about the functionality anyway)...

But I couldn't figure how to insert hyperlink data in the table. I only get the displayed text set, but not the target one.

Is this feasible using pyodbc or am I on the wrong track?

Thanks in advance!

Emmanuel

Upvotes: 0

Views: 191

Answers (1)

jbud
jbud

Reputation: 694

The hyperlink field in MS Access consists of three parts, separated by #:

display text # filename or target # location within the document

So an example of the data of a field can look like this:

StackOverflow#http://www.stackoverflow.com#

See the docs: https://learn.microsoft.com/en-us/office/vba/api/access.application.hyperlinkpart

and samples here also: http://allenbrowne.com/casu-09.html

Upvotes: 1

Related Questions