Variable Button Caption (Continous form)

W

Wayne-I-M

Hi

Is it possible to set the caption of a button on a continous form subject to
the content of a record's text box.

Something like (I know this will not work)

Private Sub EmailBut_Click()
If Not IsNull(Me.Emailadress) Then
Application.FollowHyperlink "MailTo:" & [Emailadress]
Me.Caption = "OK"
Else
Me.Caption = "Not Poss"
MsgBox "There is no E Mail address on file for this person",
vbInformation, "E Mail options"
End If
End Sub

Many thanks for any tips (I can't get it to work :)
 
D

Douglas J. Steele

You'd need Me!EmailBut.Caption = "OK"

Note, though, that this will change the caption on every instance of that
button on the continuous form. It's not possible to affect only one.
 
W

Wayne-I-M

Thanks Douglas,

I was just trying to find a "work-around". But seems it's not possible.
The thing is that this particular form really needs to be continous.

Oh well, always worth asking

Many thanks

--
Wayne
Manchester, England.



Douglas J. Steele said:
You'd need Me!EmailBut.Caption = "OK"

Note, though, that this will change the caption on every instance of that
button on the continuous form. It's not possible to affect only one.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Wayne-I-M said:
Hi

Is it possible to set the caption of a button on a continous form subject
to
the content of a record's text box.

Something like (I know this will not work)

Private Sub EmailBut_Click()
If Not IsNull(Me.Emailadress) Then
Application.FollowHyperlink "MailTo:" & [Emailadress]
Me.Caption = "OK"
Else
Me.Caption = "Not Poss"
MsgBox "There is no E Mail address on file for this person",
vbInformation, "E Mail options"
End If
End Sub

Many thanks for any tips (I can't get it to work :)
 
O

Oliver Straub

Hi Wayne,

may be you take this way:

Create an new field in the recordset:
But1: iif(nz([Emailadress],"")>"";"Mail to";"- missing -"

Use it as controlsource for a textbox.
This textbox must be locked / Is Hyperlink

Use the MouseUp-event of the textbox like this:
docmd.cancelevent

If nz([mailaddress],"")>"" then
Application.FollowHyperlink "MailTo:" & [Emailadress]
else
msgbox "no mailadress"
end if

--
Oliver
munich


Wayne-I-M said:
Hi

Is it possible to set the caption of a button on a continous form
subject
to
the content of a record's text box.

Something like (I know this will not work)

Private Sub EmailBut_Click()
If Not IsNull(Me.Emailadress) Then
Application.FollowHyperlink "MailTo:" & [Emailadress]
Me.Caption = "OK"
Else
Me.Caption = "Not Poss"
MsgBox "There is no E Mail address on file for this person",
vbInformation, "E Mail options"
End If
End Sub

Many thanks for any tips (I can't get it to work :)
 
W

Wayne-I-M

Thanks for that
I already created a text box based on a query coloum - was the only
work-around I could think off

Many thanks though

--
Wayne
Manchester, England.



Oliver Straub said:
Hi Wayne,

may be you take this way:

Create an new field in the recordset:
But1: iif(nz([Emailadress],"")>"";"Mail to";"- missing -"

Use it as controlsource for a textbox.
This textbox must be locked / Is Hyperlink

Use the MouseUp-event of the textbox like this:
docmd.cancelevent

If nz([mailaddress],"")>"" then
Application.FollowHyperlink "MailTo:" & [Emailadress]
else
msgbox "no mailadress"
end if

--
Oliver
munich


Hi

Is it possible to set the caption of a button on a continous form
subject
to
the content of a record's text box.

Something like (I know this will not work)

Private Sub EmailBut_Click()
If Not IsNull(Me.Emailadress) Then
Application.FollowHyperlink "MailTo:" & [Emailadress]
Me.Caption = "OK"
Else
Me.Caption = "Not Poss"
MsgBox "There is no E Mail address on file for this person",
vbInformation, "E Mail options"
End If
End Sub

Many thanks for any tips (I can't get it to work :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top