473,513 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy from a subform to a text field in the main form

5 New Member
I set up an unbound subform on a main form. I need the user to be able to choose items from the sub-form and have them populate in a bound text field in the main form in paragraph style.

The sub-form is kind of like a template the user uses to document in paragraph form.

I am a bit of a novice. I would appreciate any help.
Thank You

Juan
Jun 10 '11 #1
10 9653
jpatchak
76 New Member
You can just throw this code into your sub form's "On Current" event:
Expand|Select|Wrap|Line Numbers
  1. Forms!mainFormName.Form.mainTextBox.Value = Me.TextBoxNameFromSubform.Value
Jun 10 '11 #2
NeoPa
32,557 Recognized Expert Moderator MVP
See Referring to Items on a Sub-Form for more ways to refernce controls on your subform.
Jun 10 '11 #3
Juan Plaza
5 New Member
Jpatchak, thank you for your insight. I crossed the first hurdle which was getting the subform options recorded in the bound text box of the main form. The problem I have now is that it only records a single option. If the user picks a second option it replaces what it had recorded previously. I need it to record all the options the user picks in the text box.

Thank You

Juan
Jun 12 '11 #4
NeoPa
32,557 Recognized Expert Moderator MVP
You ask for help putting the data together, yet you don't give any indication of what that data together should look like.

A solution might be the following :
Expand|Select|Wrap|Line Numbers
  1. Forms!mainFormName!mainTextBox = IIf(IsNull(Forms!mainFormName!mainTextBox), _
  2.                                      "", _
  3.                                      Forms!mainFormName!mainTextBox & ",") & _
  4.                                  Me.TextBoxNameFromSubform
But frankly it's hard to know unless you make a bit more effort expressing the problem properly before posting.
Jun 13 '11 #5
Juan Plaza
5 New Member
NeoPa, I am sorry if I was vague. I am just try get the user to make a paragraph in a bound field of a main form from template choices in a subform.

In the click event on the unbound subform,I included:
Expand|Select|Wrap|Line Numbers
  1. variable=nz(Forms![mainform].form.bound field.value)
  2. Forms![main form].form.bound field.value= variable & chr(13) & Me![selected field in the subform].value & "."
Thank You

Juan
Jun 20 '11 #6
NeoPa
32,557 Recognized Expert Moderator MVP
I'm struggling to match this with what you requested, but a simpler form of this might be :
Expand|Select|Wrap|Line Numbers
  1. With Forms![mainform].form.[bound field]
  2.     .Value = .Value & vbNewLine & Me.ActiveControl & "."
  3. End With
I'm still guessing to a certain extent, but you might want to try it if this is what you're after.
Jun 20 '11 #7
Juan Plaza
5 New Member
NeoPa, thank you for your response. I will try it. I'll let you know how it goes.

Juan
Jun 20 '11 #8
NeoPa
32,557 Recognized Expert Moderator MVP
You're welcome. It's been a pleasure dealing with you Juan :-)
Jun 20 '11 #9
Juan Plaza
5 New Member
I am trying get everything to populate in the bound field in paragraph form. Your code works perfect except for the vbNewLine. I erased it and it gave me exactly what I was looking for.

Thank You

Juan
Jun 21 '11 #10
NeoPa
32,557 Recognized Expert Moderator MVP
My vbNewLine was simply a replacement for your Chr(13) Juan. If it works better without it then that's all good :-)

I suspect (but not sure as I don't play there much) that a bound Memo type field would display that OK, but not a Text type one. As I say though, I'm not sure.
Jun 21 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2185
by: Bill Strass | last post by:
Problem: Access main form/subform as front end to SQL Server backend. Add/edit via subforms work fine. Not so with main form. Set up a master-detail form-subform using two views linked from SQL...
2
3814
by: TDIOwa | last post by:
I have a form (frmAppointment) with a subform on it (frmAppointmentsub1). I have placed a command button on the main form which calls the function below from the module. The purpose of this...
2
2377
by: prakashwadhwani | last post by:
I have a (Main) form named : Stocks_Main and a Subform in that named: Stocks_Data The Subform is a continuous form There is a field in the subform called QTY_IN Now ... on the main form i.e....
3
1987
by: wideasleep | last post by:
Hi everyone, I have a subform that is a continuous form. It will have mutiple records that connect to a single record in the main form. I have set this up but running tests show only one record...
0
1923
by: Richnep | last post by:
Hi all,. I have a small issue I would like to resolve with VBA. I have a form which it's fields are bound to a table. Within that form is a subform which is a subtable. Tables relationship...
1
6081
by: ssr61 | last post by:
hi can u help me how to open a sub form with in a main form without opening a new window..... my main form (frm_searchby_Name)consists of text field to enter the address and button when...
2
1816
reginaldmerritt
by: reginaldmerritt | last post by:
Not sure if this is even possible, but i want to select a field in a sub form from a main form. I want to populate a field in the main form with a sub forms field value. eg. me.name =...
1
5571
by: Bob Alston | last post by:
I have a system where many subforms are used. Often the size of the subform had to be larger than could be displayed without scrolling. I set the height of the subform to the typical height...
2
2390
by: ndeeley | last post by:
Hello, I've not had a lot of luck getting this to work, despite looking around lots of websites, so here goes... I have a main form frmProjectScheduler. It's a tabbed form and the front page is...
4
2056
anurag275125
by: anurag275125 | last post by:
Hello, can anyone please tell me how can I create a input text field in form that can only accept numbers. thanks
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5085
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.