Can a field value be inserted in message box text?

G

Guest

Hi.

I have combo with some After Update event code which, in certain
circumstances, will display a message box that says "There is more than one
Mentor for the School selected".

Could I arrange for the Mentor subject, which is the content of txtSubject
(on the same subform as the combo) to be inserted just before the word Mentor
in the message. It would then say, for example, "There is more than one Music
Mentor for the School selected". The word Music would change to Maths,
Geography etc, depending on the content of txtSubject in the particular
record selected. Can this be done?

Thanks for any help. JohnB
 
A

Allan Murphy

Your message box would be

msgbox("There is more than one " & mentor & " for the School selected")

where mentor is the content of txtSubject


If the message box is too wide you could use

msgbox("There is more than one " & _
vbcrlf & mentor & _
vbcrlf & " for the School selected")
this will spread the message over three lines.
 
G

Guest

Thanks Allan.

Hmmm. perhaps I didn't explain very well. I was hoping to get acces to
insert the content of field txtSubject automatically, not put it in myself.
Do you mean I should use:

msgbox("There is more than one " & txtSubject & " Mentor for the School
selected")

If this is correct I would have to state the full path to txtSubject, I
presume.

Thanks, JohnB
 
G

Guest

Yes, that is the idea behind that, pass the txt value to the message

msgbox "There is more than one " & Me.txtSubject & " Mentor for the School
selected"

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
G

Guest

Thank you. JohnB

Ofer said:
Yes, that is the idea behind that, pass the txt value to the message

msgbox "There is more than one " & Me.txtSubject & " Mentor for the School
selected"

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 

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