×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can expressions be stored in a table and then displayed on a form in a textbox?

Can expressions be stored in a table and then displayed on a form in a textbox?

Can expressions be stored in a table and then displayed on a form in a textbox?

(OP)
Hello,

I would like to store some default text in a settings table.

For example I would store: ="Hello" & [FirstName] & " " & "[LastName]"

I was hoping when the record was displayed in a textbox on a form it would give me the result: Hello John Smith

Unfortunately it just shows the value: "Hello" & [FirstName] & " " & "[LastName]"

Is there anyway around this?

Many thanks Mark

RE: Can expressions be stored in a table and then displayed on a form in a textbox?

Where is [FirstName] & [LastName] coming from?

How are you transforming the placeholders into the values you require?

Why aren't you making the value of the form field your concatenation?

Or you could make the column in the table computed

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: Can expressions be stored in a table and then displayed on a form in a textbox?

I do not understand why you would do this, but it is possible to run a different calculated control value for each record. So imagine I had a table with a field that contained a field called strCode. It would look like this

CODE


ID	strCode
1	=Now()
2	=Date()
3	="The ID is: " & [ID]
4	="Today is: " & Format(date(),"dddd")
 

Then on the form I have an unbound textbox called txtbxunbound
On the form's current event I have

CODE

Private Sub Form_Current()
  If Not Me.NewRecord Then
    Me.txtBxUnbound.ControlSource = Me.strCode
  End If
End Sub 
For each record it shows a different calcuated value from a different expression.

Makes no sense to me, but could be done.

RE: Can expressions be stored in a table and then displayed on a form in a textbox?

I can't imagine why you'd want to do this - it feels like very bad-practice.

However, take the double quotes off "[Lastname]" and save that to a record, assign that record field content as the text box ControlSource - it should work as you intend.

E.g. store EXACTLY this:

CODE

="Hello " & [FirstName] & " " & [LastName] 

N.B. I've added a space at the end of 'Hello'.

ATB,

Darryllewink

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close