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

Concatenate two strings into one

Status
Not open for further replies.

1510982

Programmer
Joined
Feb 17, 2002
Messages
57
Location
SI
Let's say my database has two columns - name and last_name. On the report, I want them concatenated (joint) together, like "name last_name" in one label or text_box. Is this possible?
And I always wondered, can I create a report that would accept parameters from form that is it called and that it wouldn't control any source. Thanks for answers in advance.
 
Dear 1510982,
I got this from Access Help:
Open the form in Design view or the report in Design view.
Add a calculated text box for the fields you want to combine.

To display the property sheet, make sure the text box is selected, and then click Properties on the toolbar.

Do one of the following:

1. Add a Text box from the tool box

In the ControlSource property box, type an expression that combines the appropriate fields.

or
2. Click the Build button to use the Expression Builder to create the expression.

For example, to return an address like

650 22nd Ave. W., Seattle WA 98542

type this expression:

=[Address] & ", " & [City] & " " & [Region] & " " & [PostalCode]

Also see Help Contents and Index|Concatenating
About combining text values from fields when some fields contain no data

Could you also expand on "And I always wondered, can I create a report that would accept parameters from form that is it called and that it wouldn't control any source.

Regards Jim
 
Thanks, Jim33.

That helped me solve the problem.

And here's the expansion of second question. Let's say we make a form, which doesn't control any database tables nor queries. Let's say "name" and "lastname".

Now, we create a blank report, which should be ready to accept those parameters and save it into their texboxes. (name.Value and lastname.Value)

Is this possible? Thanks again!
 
Dear 1510982,
Here is what I use but it requires you to have set a PK in the Table that the names come from so that you can get the right record:

Private Sub cmdPrintYourReportName_Click()
Me.Refresh
Dim strRptName As String
Dim strWhere As String
strRptName = "YourReportName"
strWhere = "[YouRecordPrimaryKey]=" & Me!PrimaryKey
DoCmd.OpenReport strRptName, acPrintAll, , strWhere

End Sub

Fill in your details where red
HTH
Regards Jim
 
I realised immediately I posted the above that the code is not what you are looking for, but I was in a hurry, I apologise.

However I am intrigued by your question and would be very interested to know why you want the arrangement you are suggesting!
Regards Jim
 
What id=f they are two different parameters such as text and information from a text box. How do you write it so that for example:

mary strain her back, when strain is a check box option that returns a true/false value (strain for true, blank for false)?
 
Hi, james33. Sorry for delay, I was on a bussines trip.

Now, why do I need that. Let's say I just want to add just one small note to each employee just for the print of the report...

TNX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top