Merging multiple rows from a single field into a textbox (1 Viewer)

maestro83

Registered User.
Local time
Today, 17:05
Joined
Oct 15, 2008
Messages
23
I dont want to exclude addresses. The only addresses to show up are those relative to a category selected by the user prior to the addresses appearing.
 

Mike375

Registered User.
Local time
Today, 17:05
Joined
Aug 28, 2008
Messages
2,548
I made you a little demo db (A2003)

Open form Table1Form and then click the label Macro1 and the entried will be made in Table2Form.

The way I have there are 2 spaces between each.

But you have to do some yourself:)

Go to Macro 1 in Design view. As you see the actions are being repeated but that is only satisfactory for a demo. You need to macros. The first gets things going with some actions and then has a RunMacro action. The RunMacro action basically repeats the step. When you select RunMacro action you will see you have a Repeat Count and a Repeat Expression.

The Repeat Count can be a number. But that is no good because you don't know how many records there will be. You can also enter an expression like =[Forms]![FormName]![TextBoxName]. TextboxName could be a count of the records.

But the more common way is Repeat Expression and is will be based on the records ending.

If you don't want the spaces then just delete the RunCode action lines.

Instead of F2 (twice) you can use

Public Function EndofField()
Forms![ProspectNotes]!ActdateComments.SetFocus
Forms![ProspectNotes]!ActdateComments.SelStart = Len(Forms![ProspectNotes]!ActdateComments.Text)
Forms![ProspectNotes]!ActdateComments.SelLength = 0
End Function

and call that with RunCode.

To go through your whole record set on the main form you SelectObject for the form and NextRecord at the end of the "inserting process" actions on the macro that is being run by the RunMacro action.

As I mentioned earlier you can't have any Null field for the Copy action so have your query eliminate any of those.

Hope that gets you going.
 

Attachments

  • db1.mdb
    156 KB · Views: 153

Mike375

Registered User.
Local time
Today, 17:05
Joined
Aug 28, 2008
Messages
2,548
PS,

One thing I forgot to mention is to put GoToRecord and First at the start. And you might wsant to add a Sort from RunCommand.

Just remember that it will just go down the records in whatever order they are in. kind of a mechanical thing
 

Users who are viewing this thread

Top Bottom