Solved Conditional hyperlink formatting

AlliCarr

Member
Local time
Today, 20:47
Joined
Feb 19, 2024
Messages
57
Hi,

Is it possible to use VBA to format a text box control as a hyperlink when only certain conditions are met?

Here is a snip from a continuous form I have which lists the tasks assigned to a user:
1722867155349.png

What I would like to do is only format the 4th column as a hyperlink when there is a number other than 0 in there so that the user completing the task can click the number and be taken to the appropriate record. If there is a 0 in there, then I would rather not have the hyperlink as this just takes the user to a blank record.

Is there any way I can do this? I have tried the 'Control.Hyperlink' property and the 'DisplayAsHyperlink' property but without success.

Any help would be greatly appreciated.
 
Rather than use the hyperlink method, you can format it with and with out the underline conditionally.
Then in the double click event check the value and open the form main record form if appropriate.
 
How about storing a Null instead of 0 in the field?
 
Would replacing the zeroes with nulls also an acceptable approach?

Edit: Oops, too slow. Sorry...
 
Rather than use the hyperlink method, you can format it with and with out the underline conditionally.
Then in the double click event check the value and open the form main record form if appropriate.
Brill! Thanks, works perfectly!
 

Users who are viewing this thread

Back
Top Bottom