472,789 Members | 910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

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

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

✓ answered by jpatchak

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

10 9564
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,534 Expert Mod 16PB
See Referring to Items on a Sub-Form for more ways to refernce controls on your subform.
Jun 10 '11 #3
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,534 Expert Mod 16PB
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
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,534 Expert Mod 16PB
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
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,534 Expert Mod 16PB
You're welcome. It's been a pleasure dealing with you Juan :-)
Jun 20 '11 #9
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,534 Expert Mod 16PB
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
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
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
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
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
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
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
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
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
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
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
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.