473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A2K - create new record in subform from main form

Thanks for the replies to my previous post. So while I'm on a roll
here's another plea for help.

I simply need the code for a button on the main form that will create a
new record in the subform. Hopefully this will always force the new
row to be selected (i.e it scrolls to the bottom if needed).

Extensive googling has given me many threads and the clearest answer
seems to be set focus to the subform and then create the record;

Forms!frmStaff! frmDetails_subf orm.Form.Date.S etFocus
DoCmd.GoToRecor d , , acNewRec

This simply creates a new parent record and the control doesn't get the
focus.

Any help?

Thanks
Martin
Nov 13 '05 #1
2 2953
Deano wrote:
Thanks for the replies to my previous post. So while I'm on a roll
here's another plea for help.

I simply need the code for a button on the main form that will create a
new record in the subform. Hopefully this will always force the new
row to be selected (i.e it scrolls to the bottom if needed).

Extensive googling has given me many threads and the clearest answer
seems to be set focus to the subform and then create the record;

Forms!frmStaff! frmDetails_subf orm.Form.Date.S etFocus
DoCmd.GoToRecor d , , acNewRec

This simply creates a new parent record and the control doesn't get the
focus.

Any help?

Thanks
Martin


See if this gets you close. I created a button on the main form with
the name CommandNewSubFo rmRec. SubFormName is the name of the
subform....chan ge it to your subform name.

Private Sub CommandNewSubFo rmRec_Click()
Me.SubformName. SetFocus
DoCmd.GoToRecor d acActiveDataObj ect, , acNewRec
End Sub
Nov 13 '05 #2
Salad wrote:
Me.SubformName. SetFocus
DoCmd.GoToRecor d acActiveDataObj ect, , acNewRec


Salad, I love you man. That works!
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
8380
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record number changes fine. Within this main form I have a subform detailing distribution records for the contact (main form is based on this) that also has...
7
11172
by: ChrisR | last post by:
Hi guys My app is a simple Main form with a few Subforms that are not linked, and a few pop forms. Problem is: I have a pop form with a Listbox with a list of records related to the subform in the Main form. I'd like to double click on the selected file in the listbox and load that record into the the Subform, easy
6
3933
by: Steve | last post by:
I have a form, primary subform and secondary subform. A tab control takes up all the area of the primary subform. There are about 15 tabs on the tabcontrol. Each tab contains fields from the same table. Related fields appear on each tab. There is one field in the table that needs to be displayed at all times so I created the secondary subform...
1
1550
by: amywolfie | last post by:
Whenever a record is modified on frmMain, I want the Event(AfterUpdate) to ADD a new record to frmRevisionHistory and goto this form. I also need to Set the FK_ID field of frmRevisionHistory to the PK_Fee of frmMain. I know how to do this easily in FileMaker, but not Access. Can anyone help? Thanks,
1
2224
by: dee | last post by:
I have a main form "FmLeads". It contains a field "Salesman" which has an 'After Change' Event Procedure. The Main form "FmLeads", contains a subform "FmDispoHistory". It displays all historic Salesman changes in continuous form format. It is related to with ONE "FmLeads" record -->MANY "FmDispoHistory" records via an ID field.
7
3402
by: FNA access | last post by:
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the mainform. My subform in the detail section goes blank (this is what I want) but my subform in the footer section appears to have the data from the...
2
4325
by: gavm360 | last post by:
Hello, I have a data entry form that has a button to copy the values of fields (CASECODE,STEPDES,CBOANSWER) into the fields (CASECODE,STEPDES,ANSWER) of a subform on the page. Private Sub cmdANSWER_Click() Forms!FRMMENU1!FRMANSWERSsubform! = Forms!FRMMENU1! Forms!FRMMENU1!FRMANSWERSsubform! = Me!
4
1928
by: banderson | last post by:
Hello, I am having a problem getting a new record in a subform to append to the underlying table. When I add a new record to the main form, the subform is blank, except for the ID field, which is populated because of its link to the main form. I would like this new record, populated at this point only with the ID from the main form, to then be...
0
2366
by: TD | last post by:
I have a main form with two subforms (both in datasheet view), neither of which are linked to the main form. The main form is based on a query that uses the bound column of a combobox on the main form as the criteria for the query. The combobox is based on a query that retrieves the name and record id of the customers. In the afterUpdate...
0
7425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5351
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5069
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1911
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 we have to send another system
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.