473,503 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy text field on MSaccess form to another field within the same form

38 New Member
Can anyone help me. I have a database that has a form. On the form I have a subform that brings in some data that is relevant to the data on the main form but from a week before (status of projects it was the data is about).
If things haven't changed I want someone to click on a button so that the data from the week before goes into the spot for this weeks data. I can't get it to work. I have tried using the expression builder on the on click property of the button and telling it that
[Status_for_Week_Ending]=Forms![qryForReview subform1]!Status_for_Week_Ending
However this does not work.
Any suggestions?
Mar 20 '07 #1
17 3588
Denburt
1,356 Recognized Expert Top Contributor
Not sure if I understand and I am missing some details.

Status_for_Week_Ending

Are you saying that you want to update this field with a new date and would that be todays date or the end if this week. Is this field on the main form or the subform?

Main Form
Me!Status_for_Week_Ending = DateAdd("d",7,Me!Status_for_Week_Ending)

SubForm
Me!MySubForm.Form!Status_for_Week_Ending = DateAdd("d",7,Me!MySubForm.Form!Status_for_Week_En ding)
Mar 20 '07 #2
amanda27
38 New Member
I'm sorry. I already have the date figured out. I just want it to copy data from one memo field and put it into another memo field with the click of a button.
Thanks

Not sure if I understand and I am missing some details.

Status_for_Week_Ending

Are you saying that you want to update this field with a new date and would that be todays date or the end if this week. Is this field on the main form or the subform?

Main Form
Me!Status_for_Week_Ending = DateAdd("d",7,Me!Status_for_Week_Ending)

SubForm
Me!MySubForm.Form!Status_for_Week_Ending = DateAdd("d",7,Me!MySubForm.Form!Status_for_Week_En ding)
Mar 20 '07 #3
Denburt
1,356 Recognized Expert Top Contributor
I am still not clear about where the controls reside from looking at what you have up top I think you want the date in the subform to be transfered to a control on the main form?

Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form!Status_for_Week_Ending
Mar 20 '07 #4
amanda27
38 New Member
I am not sure how else to explain it. I just have a memo field that will auto fill based on criteria when the form opens (this field is in a subform on the main form). I want a button on the form to take that text from that memo field and put it in a new memo field that is already on the form (this field is on the main form) if the button is clicked.

I am still not clear about where the controls reside from looking at what you have up top I think you want the date in the subform to be transfered to a control on the main form?

Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form!Status_for_Week_Ending
Mar 21 '07 #5
Denburt
1,356 Recognized Expert Top Contributor
If the button is on the main form and both memo fields are named the following code should work. A word of advice also I am using MS Access 2003 and recently I had two different databases kick back and scream at me for using underscores (don't know why) it took a lot of effort to change my tables and queries.

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form![Status_for_Week_Ending]
  2.  
If your button is on the subform then you should use the following:
Expand|Select|Wrap|Line Numbers
  1. Me.parent![Status_for_Week_Ending]=Me![Status_for_Week_Ending]
  2.  
Try it out and let me know.
Mar 21 '07 #6
amanda27
38 New Member
That is the code I am using minus the Me!, it gives me this error when I use it:
The expression On Click you entered as the event property setting produced the following error: The object doesn't contain the Automation object 'qryForReview subform1.'.
Any idea what this means or what to do?

If the button is on the main form and both memo fields are named the following code should work. A word of advice also I am using MS Access 2003 and recently I had two different databases kick back and scream at me for using underscores (don't know why) it took a lot of effort to change my tables and queries.

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form![Status_for_Week_Ending]
  2.  
If your button is on the subform then you should use the following:
Expand|Select|Wrap|Line Numbers
  1. Me.parent![Status_for_Week_Ending]=Me![Status_for_Week_Ending]
  2.  
Try it out and let me know.
Mar 21 '07 #7
Denburt
1,356 Recognized Expert Top Contributor
First you should always use Me! or something to that effect otherwise the program will have to try and figure out if it is a variable or an object on the form.

Check to make sure your subform control on the main form contains the name [qryForReview subform1] and they are spelled exactly the same. Then use the code I provided as is (unless the subform control name needs to be changed).
Mar 21 '07 #8
amanda27
38 New Member
What if it then says: The expression On Click you entered as the event property setting produced the following error: The object doesn't contain the Automation object 'Me.'.

First you should always use Me! or something to that effect otherwise the program will have to try and figure out if it is a variable or an object on the form.

Check to make sure your subform control on the main form contains the name [qryForReview subform1] and they are spelled exactly the same. Then use the code I provided as is (unless the subform control name needs to be changed).
Mar 21 '07 #9
Denburt
1,356 Recognized Expert Top Contributor
I think the pertinent question now is where are you using this snipet of code?

If you look at the form in design view check to see if the properties for the form are shown if not then on the menu bar click view and properties. On the properties sheet look for the "On Click" event set this to [Event Procedure] Then look to the right (While your cursor is in this field) and on the far right you can click a button that takes you to the VB window add the code right there and it should work.
Mar 21 '07 #10
amanda27
38 New Member
I did that. It is still not working. It gives me an error saying it can't be found. Then I have the option to end or debug.

I think the pertinent question now is where are you using this snipet of code?

If you look at the form in design view check to see if the properties for the form are shown if not then on the menu bar click view and properties. On the properties sheet look for the "On Click" event set this to [Event Procedure] Then look to the right (While your cursor is in this field) and on the far right you can click a button that takes you to the VB window add the code right there and it should work.
Mar 21 '07 #11
Denburt
1,356 Recognized Expert Top Contributor
OK sounds like were getting there.

1. Is this button on the main form or subform?
2. Are you sure both fields are named Status_for_Week_Ending
3. Are these fields disabled or locked for any reason?
3 If the button is in the subform are you sure the subform control is named qryForReview subform1
Mar 21 '07 #12
amanda27
38 New Member
1. The button is on the main form.
2. Yes both fields are named Status_for_Week_Ending.
3. No the are not disabled or locked for any reason.
4. NA

Let me know what else I can do? Thanks for all your help.


OK sounds like were getting there.

1. Is this button on the main form or subform?
2. Are you sure both fields are named Status_for_Week_Ending
3. Are these fields disabled or locked for any reason?
3 If the button is in the subform are you sure the subform control is named qryForReview subform1
Mar 22 '07 #13
Denburt
1,356 Recognized Expert Top Contributor
Actually in my last post my third question was mistated, however you did clarify a few things for me such as the button is on the main form. Now if you just make sure the subform control is named [qryForReview subform1] then there is no reason I can think of that would prevent this from working.

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form![Status_for_Week_Ending]
  2.  
You could try the following it may help you resolve this issue. Change the lin in question with the two following examples first try one then change it and try the next:

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]="This should work"
  2.  
If that works great, if not then the field name needs to be checked. Now change it to read:

Expand|Select|Wrap|Line Numbers
  1. Me![qryForReview subform1].Form![Status_for_Week_Ending] = "If this doesn't work check the subform control name and the field name"
  2.  
I so hope this helps. :) Good Luck and you are welcome anytime.
Mar 22 '07 #14
Denburt
1,356 Recognized Expert Top Contributor
I just spotted this in the Articles section and it may help you understand how to reference subforms.

Referring to Items on a Sub-Form
Mar 22 '07 #15
amanda27
38 New Member
Ok the first one worked. The second one said
Run-time error '2448':
You can't assign a value to this object.

Do you know what this means?

Actually in my last post my third question was mistated, however you did clarify a few things for me such as the button is on the main form. Now if you just make sure the subform control is named [qryForReview subform1] then there is no reason I can think of that would prevent this from working.

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]=Me![qryForReview subform1].Form![Status_for_Week_Ending]
  2.  
You could try the following it may help you resolve this issue. Change the lin in question with the two following examples first try one then change it and try the next:

Expand|Select|Wrap|Line Numbers
  1. Me![Status_for_Week_Ending]="This should work"
  2.  
If that works great, if not then the field name needs to be checked. Now change it to read:

Expand|Select|Wrap|Line Numbers
  1. Me![qryForReview subform1].Form![Status_for_Week_Ending] = "If this doesn't work check the subform control name and the field name"
  2.  
I so hope this helps. :) Good Luck and you are welcome anytime.
Mar 22 '07 #16
amanda27
38 New Member
Nevermind that was my error! IT WORKS!!!
You are awesome!
Thanks so much!

Ok the first one worked. The second one said
Run-time error '2448':
You can't assign a value to this object.

Do you know what this means?
Mar 22 '07 #17
Denburt
1,356 Recognized Expert Top Contributor
Tickles my insides, glad it works happy to help. :)
Mar 22 '07 #18

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

Similar topics

6
7281
by: jochen scheire | last post by:
Is there a way I can calculate a field in a form based on another field in the same form. When clicking submit, both values should be posted to the next page. I want to be able to type in a value...
1
2984
by: john_liu | last post by:
I have a field called AMOUNT in MS Access with values of 10, 20, 30, 40, and I want to create another field called TOTAL like this: if the value in field AMOUNT=20, then TOTAL=AMOUNT*3, else...
6
7732
by: Carlos | last post by:
Hi all, I am trying to access a public field of another form class within the same namespace. The field is public, what is the best way to access it from a different class? I defined as private...
1
3153
by: compl | last post by:
I have a database that I need to restrict the ability to edit one field based on another. The two fields are DOS (date) and Amount (currency). I only want the users to be able to edit the Amount...
2
4006
by: yesgirl | last post by:
Hello, In an Access 2003 form, I have a combo box that offers numerous selections. If certain values are chosen (i.e. "Done") then a date in another field in the form must be entered...
2
1310
by: erobinso | last post by:
In IE it is simple to address form fields with the same name in multiple forms, such as: document.firstform.mode.value='open'; document.secondform.mode.value='new'; etc But in Firefox I am...
8
2873
by: 14erclimb | last post by:
Hi, what a great resource this forum is! Hopefully you all can help: I have one field called "OPERATION_NO" another called "WORK_CENTER_NO" and another field called "OPER_STATUS_CODE" I'm using...
3
8734
by: PowerLifter1450 | last post by:
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has...
11
3875
by: clloyd | last post by:
I have a phone number field (BusinessPhone) that I only want to display in my query results if the user has selected yes (yes/no field) in another field (Business Y/N field). The premise is that...
3
1681
by: neelsfer | last post by:
how can one copy the first 6 digits of an Identity number field (yymmdd) (ie 6302185140091)in a table, into a separate birthdate field in the same table and add it in the format ddmmyyyy (18021963)...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
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
7464
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...
0
4680
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
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
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.