Concatinate multiple times

R

Ray

I have two forms, Form1 and Form2. Form1 has a
textbox, "CopyTo" and Form2 has a textbox, "CopyFrom".
Form1 is open and Form2 is open and has focus. The
control source Table for Form2 has multiple records. I
want to create a Command Button on Form2 which will
concatinate all the records in text box CopyFrom into
CopyTo. I have been able to copy from CopyFrom to CopyTo
using the following....

Forms.Form1.CopyTo = Me.CopyFrom

I want to scan thru the records and concatinate each one
I select into CopyTo by using something like...

Forms.Form1.CopyTo = [Forms.Form1.CopyTo] & ". " &
[Me.CoptFrom]

It doesnt work. Can you help.
 
G

Guest

in Form2 code, on the onClick event of button

Dim Rcd as recordset, ConcatStr as strin
set rcd=me.recordsetclon
rcd.moveFirs
ConcatStr=rcd!CopyFrom 'replace field name with correct nam
rcd.moveNex
do until rcd.eo
ConcatStr=ConcatStr & ". " & rcd!CopyFro
rcd.moveNex
loo
rcd.Clos
set rcd=nothin
forms!form2!copyTo=ConcatStr
 
R

Ray

I got 2 suggestions and both are perfect for my needs.
One is perfect for manual operation and I need that
capability. The other is perfect for a filtered set of
records and I need that also. Thanks so much.. Also****
Venae, Vidae, Bitchae (Women came, Women saw, and they
complained like hell.)
-----Original Message-----
If I understand, you want to be able to select only
certain records (maybe not all) and concatinate the
values and put them in another control on another form.
Open Form2 to add code and paste in the following

Option Compare Database
Option Explicit

Dim tempString As String

'*** this is the code for the double click event of hte CopyFrom control
Private Sub CopyFrom_DblClick(Cancel As Integer)
tempString = tempString & ", " & Me.ActiveControl
End Sub

'*** this is the code for the click event a button to add tempString to CopyTo
' change Command4 to the name of your button
Private Sub Command4_Click()
Forms.Form1.CopyTo = tempString
tempString = Null
End Sub


Every time you double click the CopyTo control, it adds
the data to the variable tempString seperated by a comma
and a space.
When you are through adding, click on the button to move
tempString to the Form1 - CopyTo control. Then
tempString is set to null.
 
R

Ray

I got 2 suggestions and both are perfect for my needs.
One is perfect for manual operation and I need that
capability. The other is perfect for a filtered set of
records and I need that also. Thanks so much..
 
G

Guest

records and I need that also. Thanks so much.. Also****
Venae, Vidae, Bitchae (Women came, Women saw, and they
complained like hell.

LO
Thanks, I hadn't seen that on

........... but since I want to live, I stick with what I have<grin

How about

"Nunc Tutus Exitus Computarus.
(It's Now Safe To Turn Off Your Computer.

Stev
 

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