If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Copy Data from One Form to another
Hello Cliff,
Yes that makes sense and that is what I have tried froim the book, but nope it don't happen for me. I have the Main form frmCompany with CompanyAddress1, CompanyAddress2 etc and the sub form frm_Sub_Agent with AgentAddress1, AgentAddress2 etc so I wrote...... Private Sub Command8_Click (which as you know appears automatically) with [Forms] ! [frm_Sub_Agent] ! [txtCompanyAddress1] = [txtAgentAddress1] etc End with End Sub But what I get is...............Runtime error 2450 can't find 'frm_Sub_Agent' referred to It is there and the names are correct Sorry to pester you but just imagine you are having to explain this to a man from Mars , I literally need the painting by Numbers version of an explanation, though from what I can see, oit's all correct. The method seems correct, "In the currewnt form, when clicking th command button, copy the text from the field CompanyAddress1 to the sub form frm_Sub_Agent to the field AgentAddress1 Thanks mikeyb wrote: Hello Chris and thanks, Very useful but am at a loss as to what to call what I get the gist of it but for example what is frmOther - is it a built in form name or, and I would think this is the case, a name of a form I have created. I understand that for the click event I copy from one form to another but the form names you give as an example show the same form name twice? I'll do some experimenting Thanks again Hi Mikey, [quoted text clipped - 30 lines] existing company address to the new Address table and then somehow do the same with Agents' addresses -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...esign/200903/1 |
#12
|
|||
|
|||
Copy Data from One Form to another
Hi Mikey,
The spacing around the exclamation point most likely is an issue. Also as you are assigning the company address to the agent's address, try changing [Forms] ! [frm_Sub_Agent] ! [txtCompanyAddress1] = [txtAgentAddress1] to [Forms]![frm_Sub_Agent] ![txtAgentAddress1] = [txtCompanyAddress1] Hope that does it. Clifford Bass "mikeyb via AccessMonster.com" wrote: Hello Cliff, Yes that makes sense and that is what I have tried froim the book, but nope it don't happen for me. I have the Main form frmCompany with CompanyAddress1, CompanyAddress2 etc and the sub form frm_Sub_Agent with AgentAddress1, AgentAddress2 etc so I wrote...... Private Sub Command8_Click (which as you know appears automatically) with [Forms] ! [frm_Sub_Agent] ! [txtCompanyAddress1] = [txtAgentAddress1] etc End with End Sub But what I get is...............Runtime error 2450 can't find 'frm_Sub_Agent' referred to It is there and the names are correct Sorry to pester you but just imagine you are having to explain this to a man from Mars , I literally need the painting by Numbers version of an explanation, though from what I can see, oit's all correct. The method seems correct, "In the currewnt form, when clicking th command button, copy the text from the field CompanyAddress1 to the sub form frm_Sub_Agent to the field AgentAddress1 Thanks |
#13
|
|||
|
|||
Copy Data from One Form to another
Sorry Cliff, same error!
Seemingly this should be such a simple operation, but in the time honoured way of computers, it's exasperating. It says Access cannot find the form but it's there! I tried altering the spacing and such biut keep getting the 2450 error did a search on that on the internet and it seems it's quite a common problem Thanks for your efforts though Clifford Bass wrote: Hi Mikey, The spacing around the exclamation point most likely is an issue. Also as you are assigning the company address to the agent's address, try changing [Forms] ! [frm_Sub_Agent] ! [txtCompanyAddress1] = [txtAgentAddress1] to [Forms]![frm_Sub_Agent] ![txtAgentAddress1] = [txtCompanyAddress1] Hope that does it. Clifford Bass Hello Cliff, [quoted text clipped - 32 lines] Thanks -- Message posted via http://www.accessmonster.com |
#14
|
|||
|
|||
Copy Data from One Form to another
Hi Mikey,
Okay, that is not working; maybe because it is opened as a subform. Try this instead: With [frm_Sub_Agent].Form ' etc. End With This assumes you have accepted the default name for the subform control as being the same as the name of the actual form. Let me know, Clifford Bass "mikeyb via AccessMonster.com" wrote: Sorry Cliff, same error! Seemingly this should be such a simple operation, but in the time honoured way of computers, it's exasperating. It says Access cannot find the form but it's there! I tried altering the spacing and such biut keep getting the 2450 error did a search on that on the internet and it seems it's quite a common problem Thanks for your efforts though |
#15
|
|||
|
|||
Copy Data from One Form to another
Hello Clifford,
pardon my ignorance but what do I put after......With [frm_Sub_Agent].Form???? ??? Both forms are open - well the main form with the subform included and i am putting the command button on the main form as the subform is a datasheet I have scoured the web and there seems no simple answer to what surely is the most simple of requests copy data from form1 to form2 Thanks Clifford Bass wrote: Hi Mikey, Okay, that is not working; maybe because it is opened as a subform. Try this instead: With [frm_Sub_Agent].Form ' etc. End With This assumes you have accepted the default name for the subform control as being the same as the name of the actual form. Let me know, Clifford Bass Sorry Cliff, same error! [quoted text clipped - 6 lines] Thanks for your efforts though -- Message posted via http://www.accessmonster.com |
#16
|
|||
|
|||
Copy Data from One Form to another
Hi Mikey,
No problem. Just put all of the stuff you had befo With [frm_Sub_Agent].Form ![txtAgentAddress1] = [txtCompanyAddress1] ![txtAgentAddress2] = [txtCompanyAddress2] ![txtAgentCity] = [txtCompanyCity] ' etc. End With Clifford Bass "mikeyb via AccessMonster.com" wrote: Hello Clifford, pardon my ignorance but what do I put after......With [frm_Sub_Agent].Form???? ??? Both forms are open - well the main form with the subform included and i am putting the command button on the main form as the subform is a datasheet I have scoured the web and there seems no simple answer to what surely is the most simple of requests copy data from form1 to form2 Thanks |
#17
|
|||
|
|||
Copy Data from One Form to another
Hello Clifford,
Am afraid not, now I get........."Access cannot find the field '|' referred to in your expression" and there isn't a '|' to be seen anywhere. have looked on the web and again it seesm to be a question of syntax but cannot find a solution to that one. Have tried 'Private Sub Command8_Click (Cancel As Integer)' which was suggested t someone else on another web site but it doesn't fix it Trying to get Access to do the simplest of things is like pulling teeth! Thanks again Clifford Bass wrote: Hi Mikey, No problem. Just put all of the stuff you had befo With [frm_Sub_Agent].Form ![txtAgentAddress1] = [txtCompanyAddress1] ![txtAgentAddress2] = [txtCompanyAddress2] ![txtAgentCity] = [txtCompanyCity] ' etc. End With Clifford Bass Hello Clifford, [quoted text clipped - 8 lines] Thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...esign/200903/1 |
#18
|
|||
|
|||
Copy Data from One Form to another
Hi Mikey,
It is an odd error, but you will come to recognize it as meaning that it cannot find one of the named fields/controls. I know this method should work as I tested it out earlier today. Try this: While in design mode, click on your subform once so that the subform as a whole is highlighted around the edges. If the properties window is not showing press Alt-Enter. What does it show as the Name of the subform in the Other (or All) tab? If it does not show frm_Sub_Agent, change it to frm_Sub_Agent. Then try the copy process again. If you still get the same error, click in the left margin of the VBA Editor code window on the With [frm_Sub_Agent].Form line. This will place a break point on that line, identified by a large dot. Try running the copy process again. It will stop at that line. Press Shift-F8. It should not give you an error on that line. If it does let me know. Now, you can hover your cursor over the various control names in the following code and it will show you the current values. If any do not report anything or if you get an error message, you will need to correct the name. Next, press Shift-F8 repeatedly to have it execute each line. If it bombs out on any, those lines will need fixing. Repeat until it is all fixed. Let me know how it goes. Clifford Bass "mikeyb via AccessMonster.com" wrote: Hello Clifford, Am afraid not, now I get........."Access cannot find the field '|' referred to in your expression" and there isn't a '|' to be seen anywhere. have looked on the web and again it seesm to be a question of syntax but cannot find a solution to that one. Have tried 'Private Sub Command8_Click (Cancel As Integer)' which was suggested t someone else on another web site but it doesn't fix it Trying to get Access to do the simplest of things is like pulling teeth! Thanks again |
#19
|
|||
|
|||
Copy Data from One Form to another
Thanks again Clifford,
Am off up the Wooden Hill to Bedfordshire now so will try it tomorrow. Have been working on a workaround where I put a button on the form to an Append Query where the user will have to type in the current CompanyID and then it just tags the current Address1, 2 etc onto the AgectAddress1, 2 etc. But I still want to get this forms method conquered! Have been tryigmn to get it working on a toy database with just 2 tables, each with ID, Add1, Add2, A form including Subform - could I zip that upi and see if you could see where am going wrong? Thanks again for all your help, you certainly are a very helpful person! Mike B Clifford Bass wrote: Hi Mikey, It is an odd error, but you will come to recognize it as meaning that it cannot find one of the named fields/controls. I know this method should work as I tested it out earlier today. Try this: While in design mode, click on your subform once so that the subform as a whole is highlighted around the edges. If the properties window is not showing press Alt-Enter. What does it show as the Name of the subform in the Other (or All) tab? If it does not show frm_Sub_Agent, change it to frm_Sub_Agent. Then try the copy process again. If you still get the same error, click in the left margin of the VBA Editor code window on the With [frm_Sub_Agent].Form line. This will place a break point on that line, identified by a large dot. Try running the copy process again. It will stop at that line. Press Shift-F8. It should not give you an error on that line. If it does let me know. Now, you can hover your cursor over the various control names in the following code and it will show you the current values. If any do not report anything or if you get an error message, you will need to correct the name. Next, press Shift-F8 repeatedly to have it execute each line. If it bombs out on any, those lines will need fixing. Repeat until it is all fixed. Let me know how it goes. Clifford Bass Hello Clifford, [quoted text clipped - 9 lines] Thanks again -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...esign/200903/1 |
#20
|
|||
|
|||
Copy Data from One Form to another
Hello Clifford, here I am again!
Yes it stops at the first line containing the references to the field I have pasted the snippet below.....error 2465 cannot find the field '|' Private Sub Command10_Click() With [frm_Sub_Agent].Form Stops at this line = ![txtAgentAddress1] = [txtCompanyAddress1] ![txtAgentAddress2] = [txtCompanyAddress2] End With End Sub The field names I have checked and checked. By the way - should my Copy Command button be on the subform? I'll try it there anyway Thanks Clifford Bass wrote: Hi Mikey, It is an odd error, but you will come to recognize it as meaning that it cannot find one of the named fields/controls. I know this method should work as I tested it out earlier today. Try this: While in design mode, click on your subform once so that the subform as a whole is highlighted around the edges. If the properties window is not showing press Alt-Enter. What does it show as the Name of the subform in the Other (or All) tab? If it does not show frm_Sub_Agent, change it to frm_Sub_Agent. Then try the copy process again. If you still get the same error, click in the left margin of the VBA Editor code window on the With [frm_Sub_Agent].Form line. This will place a break point on that line, identified by a large dot. Try running the copy process again. It will stop at that line. Press Shift-F8. It should not give you an error on that line. If it does let me know. Now, you can hover your cursor over the various control names in the following code and it will show you the current values. If any do not report anything or if you get an error message, you will need to correct the name. Next, press Shift-F8 repeatedly to have it execute each line. If it bombs out on any, those lines will need fixing. Repeat until it is all fixed. Let me know how it goes. Clifford Bass Hello Clifford, [quoted text clipped - 9 lines] Thanks again -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...esign/200903/1 |
Thread Tools | |
Display Modes | |
|
|