combining fields and other stuff

S

Striker

I have a field I would like to out on a form that combines some data from
fields in the database with some other stuff. AS an example let's say I have
a Critters Table with a Animal field. The animal filed has a value "Brown
Fox" in it.

I want A field that adds the words A Quick Brown Fox runs fast. The Brown
Fox is the only information I am storing in a table, so how do I join this
info on one text field on a form?
 
D

Douglas J. Steele

Assuming your form is bound to the Critters table, you can set the
ControlSource of the text box to

="A Quick " & [Animal] & " runs fast"

Include the equal sign.
 
L

Linq Adams via AccessMonster.com

If you want the phrase

A Quick [Animal name] runs fast

for whatever animal is in the animal field, Doug's solution is spot on. If,
on the other hand, you want a different phrase, depending on the animal
chosen, perhaps something like this:

Private Sub AnimalField_BeforeUpdate(Cancel As Integer)
Select Case AnimalField
Case "Brown Fox"
Me.PhraseField = "A Quick Brown Fox runs fast."
Case "Pig"
Me.PhraseField = "A Pig in a Poke"
Case "Cat"
Me.PhraseField = "Cat Got Your Tongue?"
Case Else
Me.PhraseField = Me.AnimalField
End Select
End Sub
 

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