Too short hyperlinks in MS Access - ms-access

Hi all you Access experts out there! :-)
I ran into an unexpected problem today. Maybe you can help me?
I create a report in Access. It has a couple of hyperlinks in it. I export the report to PDF - and the hyperlinks are preserved and clickable when the user opens the PDF. And everything works fine - I thought...
But I discovered there is a maximum "length to use" for a hyperlink. The hyperlink is created in VBA, and stored in the Hyperlink property. That's a memo field, so there is no problem setting the property to a long string. (The link is a "mailto:" to a number of people, so it can get to about 1000 characters.)
But when I click on the link in the report, the link is being truncated. If I just needed it to work in Access, I could handle this in VBA (with FollowHyperlink). But it has to work in the exported PDF too...
Any ideas? Is there any way to make Access use the whole string as hyperlink? Or another way to get the hyperlink to the PDF, other than placing it in the Hyperlink property?
Thanks in advance!
Anders
Sweden

This is an Adobe PDF problem, not an Access problem. The issue is that the PDF reader intuits what's a link and what's not, so if you're formatting your link in a way that your PDF reader can't tell it's a URL, it won't make it clickable.
I encountered this with a client's letterhead in Word, where they had their website URL in the header. They use the Word extended font spacing, and what the PDF writer generated put actual spaces between the letters (instead of changing the inter-letter spacing). The result was that the URL, which looked like a single word, e.g., http://MyWebsite.com, was actually encoded in the PDF as http://M y W e b s i t e . c o m. The only solution was choosing a font that looked the way the client wanted without the extended spacing.
So, I'd try a different font.

When you export a report as PDF and you have a Label with an Hyperlink in your report, the exporter generates a pdf tag with the format
<</Type/Action/S/URI/URI(https://www.....)>>
As result we can affirm that is not the Abobe PDF Reader that make a 'best guess' interpreting the link and thus the problem is an MS Access 'feature'...

Related

SSRS create PDF or Excel from <form> POST

According to this Microsoft dev guidance, it should be possible to have a element on a web page do a POST via the method=POST attribute of the form. It shows an example of HTML needed in order to open a report viewer to a report and render the HTML viewer. I have that working. I would like to use the exact same technique to create a PDF or Excel file, but it doesn't work when I update the Format parameter to either PDF or EXCELOPENXML. Instead it ignores that parameter and provides the HTML viewer anyway. I would like to stick to one technique for both opening the HTML viewer and for downloading the various file formats. Does anyone know a workaround? I have considered a generic function to take the hidden elements and tack them on to the action URL, and open a new window with that. Does anyone have the code to do that?
I would still be curious to know if there's an issue with the POST action for file exports, but in the meantime, I solved it with this:
$("form").find(":input[name]").map(function(val, key) {
return encodeURIComponent($(this).attr('name'))
+ '='
+ encodeURIComponent($(this).val()).replace(/%2C/g,',').replace(/%20/g,' ');
//unencode space and comma characters for convinience and shorter URLs
}).get().join("&")

SSRS - embed URL and formatting characters in parameter

I'm making a form letter in SSRS 2012 that will be delivered by email. I had it working fine but now the powers that be have requested a much more dynamic aspect to it based on the individual recipient... Different paragraphs now need to be included/excluded based on the target.
With that, I pulled the body of the email out of SSRS and am now assembling it in SQL Server and passing it over to SSRS as a parameter (so that I don't wind up making a dozen SSRS reports to handle the need).
I have that part working too now, but hit a snag... There were a few bullet points as well as URL's that could look nicer. I'd like to force an indention before the bullet points and replace www.mysite.com with something prettier like "Click Here". On the SSRS side of the fence, I currently just have a single text box (and ideally would keep it that way) which contains an expression that references my "EmailBody" parameter.
So far, I have not found the right combination of words to send to Google to see if this is possible, so I figured I'd go straight to the pros here. I did try formatting the output in a similar manner to what an expression would look like ( ="This is the body of my email" ) and it just passed that straight on through to the final output.
Any ideas would be appreciated!
Jason
In case it helps anyone else, I figured out the secret.
Change your text box in SSRS to expect HTML by right-clicking on the placeholder (<< EXP >>) inside the text box, selecting Placeholder Properties, and change the Markup Type to "HTML - Interpret HTML tags as styles".
After that, go back to the SQL Server side of the fence and change the text you are sending as a parameter to HTML with whatever styling properties you desire.
Sounds like you're on the right track with the HTML markup. I also wanted to suggest that you can use a data-driven subscription. Have the query generate the HTML you want. Then have that populate the body of the email. That way there's no need for any attachments. This has come in handy when I wanted to display a small table of data for viewing on a mobile device rather than having to open an Excel attachment.

Pasting formatted text from HTML into MS Access memo form field

I have a super simple MS Access form with two fields to collect some data quickly, one of which is a memo data type, wired into a table field. I want to copy some formatted text from HTML into it and would like to preserve the formatting (bolding, fonts, italic, etc.). However, when I do Ctrl-C --> Ctrl-V, it only pastes unformatted plain text.
Is there any way I can configure my form field to accept and save formatted text? If I paste the same into MS Word, the formatting IS preserved.
You will have to open the 'source' of the HTML file, and only then copy+paste.
From the browser, you'll just see the HTML output.. and some apps, like Notepad, won't be able to store the data through a simple copy+paste. MS Word can do it, as you might already know, since it is a rich-text editor.
As for a field in MS Access, you can only preserve the formatting if you copy the source itself. It will help if you let us know which browser you are copying from, though normally, there is an option to view the source code of the page being viewed.
[edit:in response to comment]
If you want rich text to enter into an ms access field, try the first few steps here: http://office.microsoft.com/en-001/access-help/insert-or-add-a-rich-text-field-HA010014097.aspx

Paste Image from Microsoft Office to AIR Application?

I'm in a situation where I need to accept copied images from a Word (.doc / .docx) document to a spark image on the AIR application. I tried with a sample document with an image embedded inside. When I open it up on Pages on Mac, the copied image pastes perfectly onto the the spark image object via the code below:
var clipboardImage:Bitmap = new Bitmap(Clipboard.generalClipboard.getData(ClipboardFormats.BITMAP_FORMAT) as BitmapData);
clipboardImage.width = fldPicture.width;
clipboardImage.height = fldPicture.height;
fldPicture.source = clipboardImage;
fldPicture is the spark image. This may have been okay but when I sent the AIR application and the same Word document over to a friend who runs Windows and has Microsoft Office 2010, it didn't work. It only seems to work if the copied image from the Word document is pasted to MS Paint then copied again but this time, from the MS Paint.
Sorry if this seems rather confusing, I tried to explain it as much as I could. If anyone can shed some light on this issue, it would really be appreciated.
Mmh I'm afraid it has to do with the way Word handles file formats and so.
Word uses a lot of headers, internal-code / tags only used by itself to recognize objets, text formats, images...
And I suppose the content of the clipboard coming from Word has to be stripped from this headers of some kind before it can be used, thing that Paint automatically do (thing that could explain why it works when getting to Paint before pasting it in your app).
Maybe you could try to put the pasted data into a byte array and try to remove the headers manually before getting it into a Bitmap ?...

Is there a way to get ms-access to display images from external files

I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs of some assets along with their specifications. Currently the images are stored in an MS-Access table as an OLE Object (and copy-n-pasted into the field by the users).
For various reasons, I would like to do is store the original .jpgs in a folder on the network drive, and reference them from the application portion. I have considered moving into MS-SQL's image data type (and its replacement varbinary), but I think my user population will more easily grasp the concept of the network folder.
How can I get MS Access to display the contents of a .jpg?
Another option is to put an image control on your form. There is a property of that control (Picture) that is simply the path to the image. Here is a short example in VBA of how you might use it.
txtPhoto would be a text box bound to the database field with the path to the image
imgPicture is the image control
The example is a click event for a button that would advance to the next record.
Private Sub cmdNextClick()
DoCmd.GoToRecord , , acNext
txtPhoto.SetFocus
imgPicture.Picture = txtPhoto.Text
Exit Sub
End Sub
Have you looked at Stephen Lebans' solutions? Here's one:
Image Class Module for Access
Check out the list of other great code along the left-hand side of that web page. You may find something that fully matches what you need.
I found that this article by Microsoft with full VBA worked very well for me.
How to display images from a folder in a form, a report, or a data access page
The easiest way is probably to plop an Internet Explorer onto one of your forms. Check out this site: http://www.acky.net/tutorials/vb/wbrowser/
Since you can reference that object in Access, you will only need to point the webbrowser control to the path of the .jpg (NavigateTo() if I remember correctly).
EDIT: The above link was just googled and picked from the results (first one that opened quickly). I do not think it is a very good tutorial, it just has all the pointers you need... Check out msdn etc. if you need more information!
You can try an ActiveX control called AccessImagine, makes adding images to database more convenient - you can load from file, scan, paste from buffer or drag-n-drop. You can crop image right inside the database and resample it automatically. It handles external image storage automatically if you need it.
Note that in Access 2010 (and later) this is dead simple to do because the Image control can be bound to a field in the table that contains the path to the image file (.jpg, .png, ...). No VBA required.
For more details see my other answer here.
Do you mean something like this?
Display images in MS-Access Form tabular view.
Here's the original post from microsoft:
https://learn.microsoft.com/en-us/office/troubleshoot/access/display-images-using-custom-function
You just need to modify something in the form events:
Modify this part of the form code
Image Control
Name: ImageFrame
Picture: "C:\Windows\Zapotec.bmp"
Control Source: txtImageName
Note that the Control Source named "txtImageName" is the field name in your table which has the name and path of your images.
Everything get's fine after you modify that part.