How is this control a hyperlink? (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 10:54
Joined
Sep 21, 2011
Messages
14,038
Hi all,

In the Northwind 2007 database, the id control on the form for Customer List appears to be a hyperlink.

However I can not see how this is done.?

The isHyperlink property is set to no.
Al I can find is in the Tag property HyperlinkToDetails~FormName=Customer Details~SourceID=ID

I think it is quite a nice feature and perhaps would want to use it when I create my database, if I can find out how it is done.?

TIA
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:54
Joined
Jul 9, 2003
Messages
16,244
That's a very interesting question and I would have thought the same as you, that there would be some sort of hyperlink.

I had a look and I see that there is an embedded macro. Normally I would just leave it at that because I can’t read macros. However there's a simple solution to this, I convert them to VBA and then I can read them!

On conversion to VBA, I note there is nothing that indicates the use of a hyperlink. You indicate that the tag property contains something related to a hyperlink:-

The isHyperlink property is set to no.
Al I can find is in the Tag property HyperlinkToDetails~FormName=Customer Details~SourceID=ID

To test this I deleted that text from the tag property and the form still worked fine so that's not it!

Looking through the property sheet for the text box “ID” there is a property named “Display as hyperlink” this is set to “Screen Only” Some of the other controls have this property set to “if hyperlink”. These controls do not display as a hyperlink. Changing this property of the textbox "ID" from “Display as hyperlink” to “if hyperlink” shows you that this is the reason for the ID displays as a hyperlink. You can test it yourself.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:54
Joined
Sep 21, 2011
Messages
14,038
Thank you Uncle Gizmo,

I never spotted that property. I was aware of the IsHyperlink and went straight to that.

When you say you 'convert the macro to VBA', is that just by eye, or is there a function/method to do that.?

I too know little about Access macroes (less than I do on VBA) and only used them in my last place of work to run queries/imports/exports in sequence.

It appears Northwind 2007 runs pretty much on Embedded macroes from what I have seen so far.

I was thinking that the "~" character was being used as a delimiter to split the Tag into separate variables to open the form, but could not find how it was being used.

You have indicated that it is not, so now puzzled as to why it is there.? :confused:
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:54
Joined
Jul 9, 2003
Messages
16,244
When you say you 'convert the macro to VBA', is that just by eye, or is there a function/method to do that.?

Hi Gasman,

I've done a YouTube Video "Is this Control a Hyperlink?" explaining how to convert embedded macros into VBA. I also point out a small problem that arises sometimes; that is:- Runtime Error 32538.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:54
Joined
Jul 9, 2003
Messages
16,244
I was thinking that the "~" character was being used as a delimiter to split the Tag into separate variables to open the form, but could not find how it was being used

I'm not sure what that is in the tag property. I suspect it's placed in there by a macro which is doing something else, but I'm not 100% sure. It's something that I will have to investigate when I get 5 minutes!
 

Dick7Access

Dick S
Local time
Today, 06:54
Joined
Jun 9, 2009
Messages
4,197
That's a very interesting question and I would have thought the same as you, that there would be some sort of hyperlink.

I had a look and I see that there is an embedded macro. Normally I would just leave it at that because I can’t read macros. However there's a simple solution to this, I convert them to VBA and then I can read them!

On conversion to VBA, I note there is nothing that indicates the use of a hyperlink. You indicate that the tag property contains something related to a hyperlink:-displays as a hyperlink. You can test it yourself.
I don't understand what you mean when you said you can read embedded marcos. Can't you just open the code and see each step. What am I missing?
 

Dick7Access

Dick S
Local time
Today, 06:54
Joined
Jun 9, 2009
Messages
4,197
Yes I can see the macro and I can see the Steps, but it makes very little sense to me.

My first big main church db I used almost all embedded macros as I didn't know any vba. I took be almost two years and I have it 98% converted to VBA. Here is a simple embedded macro I had from the old db. I am sure they are some that are more complicated than this one.
 

Attachments

  • EmbeddedMacroCropped.zip
    6.8 KB · Views: 188

Gasman

Enthusiastic Amateur
Local time
Today, 10:54
Joined
Sep 21, 2011
Messages
14,038
Hi Gasman,

I've done a YouTube Video "Is this Control a Hyperlink?" explaining how to convert embedded macros into VBA. I also point out a small problem that arises sometimes; that is:- Runtime Error 32538.

Thanks very much for that. That will be handy to do. I am more comfortable with VBA than macroes at the moment.
 

missinglinq

AWF VIP
Local time
Today, 06:54
Joined
Jun 20, 2003
Messages
6,423
...When you say you 'convert the macro to VBA', is that just by eye, or is there a function/method to do that...

http://www.iaccessworld.com/how-to-convert-macro-to-vb-code/

... I am more comfortable with VBA than macroes at the moment
...

And rightfully you should be! Embedded Macros are really way too rigid to be used for serious database development, which is why the experienced developers, here, seldom have answers on Macro-related questions.

Linq ;0)>
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 10:54
Joined
Jul 9, 2003
Messages
16,244
Regarding Macros.. They do offer a way to introduce yourself to VBA. In the following video I demonstrate the simple process of converting a macro into VBA.

https://youtu.be/ZiJHMCWV6hc

Video Description:-
Demonstration of how to use the Command Button Wizard to generate Macros. Demonstrates how to Convert the Macros into VBA Code. A nice and gentle way of getting a foothold in the VBA world.

However I would add that in my limited experience of converting macros, I have run across one or two issues. One was where the macro converted a TempVar (one of the new fangled variables) into a string instead of the actual variable. (I think) I'm not sure if this issue has been addressed or if it still exists. I have it recorded in an old YouTube video somewhere...
 

missinglinq

AWF VIP
Local time
Today, 06:54
Joined
Jun 20, 2003
Messages
6,423
...However I would add that in my limited experience of converting macros, I have run across one or two issues...

I fooled around with Embedded Macros when I first upgraded too v2007, just to see if they were the great improvement that the Boys of Redmond claimed (they're not!) and also did the 'convert to code' thing, to compare how they (EMs) did things, compared to how you'd do it in code. It's been a lot of years, now, and I don't remember the exact problems, but I ran into quite a number of times when the code didn't do the intended job...just something to keep in mind!

The way a lot of people find helpful, in learning VBA, is to go to

Access Options - Object Designers – Forms/Reports

and tick the Always Use Event Procedures checkbox. Then, when you use the the Wizards to create Command Buttons, Comboboxes, etc. to do things, Access will generate VBA code (rather than Embedded Macros) and you can go into the code module and see the exact code the use.

Another strategy is to reverse-engineer some simply databases. Many Access how-to manuals include code for such databases, and if you run Forms from them, look around to see what they do, then go into the code module, and figure out how they do it!

Good luck in your quest for knowledge; I've been doing this for almost 20 years, now, and learn new things all the time!

Linq ;0)>
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:54
Joined
Sep 21, 2011
Messages
14,038
Thank you for that tip.

The way a lot of people find helpful, in learning VBA, is to go to

Access Options - Object Designers – Forms/Reports

and tick the Always Use Event Procedures checkbox. Then, when you use the the Wizards to create Command Buttons, Comboboxes, etc. to do things, Access will generate VBA code (rather than Embedded Macros) and you can go into the code module and see the exact code the use.



Linq ;0)>
 

isladogs

MVP / VIP
Local time
Today, 10:54
Joined
Jan 14, 2017
Messages
18,186
Sorry to disagree with Missinglinq but this advice isn't true.

Ticking Always use event procedures does not disable embedded macros when using the wizard to create an action for a command button. What it does is take you straight to the VBE when you click the ellipsis

Unfortunately it is not possible to turn off embedded macros by default using accdb files. The only 'solution' is to revert to mdb files which in my view is a bad idea
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:54
Joined
Feb 28, 2001
Messages
26,996
I rarely use macros but there ARE reasons to use them. They are usually quick-and-dirty ways to do things until you have time to convert them to proper VBA sequences. Also, if you want to do something via Task Scheduler or other command-line operation, the command line option /x:macroname lets you run your database non-interactively. You just have to be sure that the named macro ends with an Application Quit so that you don't get a dangling instance that will never go away with help.

Outside of those two features, I dislike macros because of their poor error handling. And anyone who has seen my "damn the torpedos, full speed ahead" approach would know that I make my share of errors plus a few for good measure.
 

Users who are viewing this thread

Top Bottom