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 |
#1
|
|||
|
|||
How to add a new record to subform from main form?
hi guys,
the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. |
#2
|
|||
|
|||
How to add a new record to subform from main form?
first, make sure you're using the name of the subform control in the main
form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. |
#3
|
|||
|
|||
How to add a new record to subform from main form?
Hi Tina,
Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. . |
#4
|
|||
|
|||
NOT SOLVED - MVPS PLS HELP? How to add a new record to subform from main form?
hmmm, i tested the solution, before posting, on A2003 in an A2k format db.
went to new record in the subform without a problem. suggest you post more detail about when/where you're calling the code. also, check your subform's AllowAdditions property, make sure it's set to Yes. "Alex" wrote in message ... Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. . |
#5
|
|||
|
|||
NOT SOLVED - MVPS PLS HELP? How to add a new record to subform from main form?
yes,
it adds a new record, but to main form. Where i put the code: on the button even click, button location - main form: With Me!frm_sub_ServiceAddresses.Form DoCmd.RunCommand acCmdRecordsGoToNew End With There are main form - frm_Customers; and subform - control's name - frm_sub_ServiceAddresses. The Allow Additions property is set to Yes. Tina, when you click on the button when you tested it..what happens? does the fields in the main form become blank?- this is what happens in my case - new record to the form is added.. the fields in the subform also become blank..uderstandable. Thanks for taking time to answer my question. Alex -----Original Message----- hmmm, i tested the solution, before posting, on A2003 in an A2k format db. went to new record in the subform without a problem. suggest you post more detail about when/where you're calling the code. also, check your subform's AllowAdditions property, make sure it's set to Yes. "Alex" wrote in message ... Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. . . |
#6
|
|||
|
|||
STILL NOT SOLVED - MVPS PLS HELP? How to add a new record to subform from main form?
when i click the button in my test form (in the main form) the subform jumps
to new (blank) record; the main form is not affected at all. i added a line of code to set focus on the appropriate field in the subform, but that runs *after* the new record code runs. hopefully an MVP or some other smart person will solve this mystery for us. g "Alex" wrote in message ... yes, it adds a new record, but to main form. Where i put the code: on the button even click, button location - main form: With Me!frm_sub_ServiceAddresses.Form DoCmd.RunCommand acCmdRecordsGoToNew End With There are main form - frm_Customers; and subform - control's name - frm_sub_ServiceAddresses. The Allow Additions property is set to Yes. Tina, when you click on the button when you tested it..what happens? does the fields in the main form become blank?- this is what happens in my case - new record to the form is added.. the fields in the subform also become blank..uderstandable. Thanks for taking time to answer my question. Alex -----Original Message----- hmmm, i tested the solution, before posting, on A2003 in an A2k format db. went to new record in the subform without a problem. suggest you post more detail about when/where you're calling the code. also, check your subform's AllowAdditions property, make sure it's set to Yes. "Alex" wrote in message ... Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Thank you. . . |
#7
|
|||
|
|||
How to add a new record to subform from main form?
"Alex" wrote in message
Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Assuming the subform in question is only one level deep -- that is, it is a child of a main form, not a child of a subform -- you should be able to do it by setting the focus to the subform control, then telling Access to go to a new record on the "active data object": Me!frm_sub_ServiceAddresses.SetFocus DoCmd.GoToRecord acActiveDataObject, ,acNewRec -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#8
|
|||
|
|||
How to add a new record to subform from main form?
Yes, it worked. Thanks.
-----Original Message----- "Alex" wrote in message Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Assuming the subform in question is only one level deep - - that is, it is a child of a main form, not a child of a subform -- you should be able to do it by setting the focus to the subform control, then telling Access to go to a new record on the "active data object": Me!frm_sub_ServiceAddresses.SetFocus DoCmd.GoToRecord acActiveDataObject, ,acNewRec -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) . |
#9
|
|||
|
|||
How to add a new record to subform from main form?
cool, another "trick" to put up my sleeve!
"Dirk Goldgar" wrote in message ... "Alex" wrote in message Hi Tina, Unfortunately this command just adds a new record to a main form's recordsource. What i need just add a new record to subform's recordsource, with the slave field filled out automatically from the master field of main form... The problem is still there. Thanks. -----Original Message----- first, make sure you're using the name of the subform control in the main form. open the main form in design view, right click on the subform and select Properties. click the Other tab and look at the Name property. use that name in your code - in the main form - as follows: With Me!MySubformControl.Form DoCmd.RunCommand acCmdRecordsGoToNew End With hth "Alex" wrote in message ... hi guys, the subject line tell it all.. What is the code to add a new record to subform from the main form? The lines: Me!frm_sub_ServiceAddresses.Form.NewRecord DoCmd.GoToRecord acDataForm, Me! frm_sub_ServiceAddresses.Form, acNewRec do not work. Any suggestions? Assuming the subform in question is only one level deep -- that is, it is a child of a main form, not a child of a subform -- you should be able to do it by setting the focus to the subform control, then telling Access to go to a new record on the "active data object": Me!frm_sub_ServiceAddresses.SetFocus DoCmd.GoToRecord acActiveDataObject, ,acNewRec -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Open form, Edit button, etc | Aniko | Using Forms | 14 | July 25th, 2004 08:17 AM |
How can I move the focus to a control on a subform? | Brandon | General Discussion | 7 | July 17th, 2004 01:39 AM |
Recordset in subform based on field in parent form | Lyn | General Discussion | 15 | June 14th, 2004 03:10 PM |
Controls on Main form affecting subform? | Will | Setting Up & Running Reports | 1 | May 27th, 2004 07:37 PM |
synchronization of subform to main form | Charles Phillips | Using Forms | 1 | May 26th, 2004 12:50 AM |