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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Lower Case 1

Status
Not open for further replies.

gripper111

IS-IT--Management
Jun 28, 2011
15
0
0
US
I have a form in my Access DB and on txtDomain I have an after update code that creates a hyperlink in a caption box so I can easily go to the page. The system works fine but I want to lower case the link.

Here is the code:
***********
Private Sub txtDomain_BeforeUpdate(Cancel As Integer)
Call MakeLink
End Sub

Private Sub txtDomain_AfterUpdate()
Call MakeLink
End Sub

Private Sub Form_Current()
Call MakeLink
End Sub

' Link maker

Private Sub MakeLink()
With Me.lblHyperlink
.Caption = " & Me.txtDomain.Value
.HyperlinkAddress = .Caption

End With
End Sub

I am trying to force this caption to be lower case.
I inserted after .HyperlinkAddress = .Caption
the following

Me!txtDomain = Lcase(Me!txtDomain)

It error out at that line.

My syntax is obviously buggy. Could somebody provide a suggestion.

Thanks.
 
Can you not simply just do this?

Private Sub MakeLink()
With Me.lblHyperlink
.Caption = " & LCase(Me.txtDomain.Value)
.HyperlinkAddress = .Caption
End With
End Sub
 
Ah, ignore my last post. I only read the first half of the OP and didn't see that you already tried that LOL!

Maybe try this...

On the OnEnter event of your text box...

Private Sub txtDomain_Enter()
'Clear the text box
txtDomain.text = ""
End Sub

Change your MakeLink to...


Private Sub MakeLink()
With Me.lblHyperlink
.Caption = " & LCase(Me.txtDomain.Value)
End With
End Sub

And then on the OnExit event of your text box...

Private Sub txtDomain_Exit(cancel as integer)
With Me.lblHyperlink
.Caption = " & .Caption
.HyperlinkAddress = .Caption
End With
End Sub

I think this should suite your needs better...
 
Whoops... forgot in the last post the line

.Caption = " & LCase(Me.txtDomain.Value)

Inside of MakeLink should also be changed to...

.Caption = LCase(Me.txtDomain.Value)

These forums should really have the ability to edit posts.
 
Chunter,

That did the trick. Thank you. I was just confused about combine this code in the same line.

I appreciate the timely response.

Good Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top