Open to new record in subform

Can anyone point me in the right direction in getting a subform to open to add a new record when the main form is opened? Can do it for the main form, but having grief getting the subform to work

Thanks in advance


Post your answer or comment

comments powered by Disqus
I have the following code:

Private Sub pgARVTherapy_Click()

Forms![frmPartA]![sfrmARVTherapy].SetFocus
DoCmd.GoToControl "DrugCode"
DoCmd.GoToRecord , "", acNewRec

End Sub

When I click on the tab (pgARVTherapy), I want to go to a new record in the subform on that tab page, with the cursor on the field DrugCode. The subform is a continuous form. The cursor is on the first record instead.

Thanks for your help.

I have a form that is used to search for a project. When the correct project is found, the user double clicks it and a project info form is opened where the user can enter comments (subform). I have it set up so that if a comment has been entered previously, it cannot be edited. This means I would like the cursor to go to a new record, but currently it goes to the record that cannot be edited. Greatly appreciate it if someone can point me in the right direction. Thank you.

Hi All.

I am new here and a relative junior to Access 2007. I have created a database to capture routine daily checks to hotel rooms that are reference with an ID and date. However I have split the data into three tables, a Maintenance Table, a Housekeeping table and A Main table that houses the general info that is meaningfull to all three. I have been able to get the Main table to update the other two using a query and a form with subforms but when I add a record to the main form the Subforms do not go to a new record and I am constantly updating old records in the subform while adding new records in the Main form. Can I change this using a query or would VBA be better...please be aware I am a serious noobie to VBA.

Thanks all

I am trying to create a hotkey to navigate users from a sub-subform to the subform and enter a new record. I have tried using goto control and goto record, but both end up in errors. The problem is that Access says the subform is closed or the control i am identifying doesn't exist. Any thoughts on how to do this. I am trying to keep users from having to leave the keyboard and mouse to a new record in the subform. thanks for any suggestions.

Hello,

I have a main form with multiple subforms in tab view, right now the forms only open in edit mode, I would like all forms to open to new record mode. I know I can set the main form with the switchboard manager but what about the subforms? Help please. Thank you in advance.

Dave

Friends,

I have a problem with the new records in my subform.

I have a main form that has a subform. When a key is pressed, an action takes place where a new record is added in the subform.

However, this only works when I open the form and go to a record.

When I go to another record in the main form without closing the form, there are two new records added in the subform when the key is pressed.

Why is this? Everyone will probably need more information, but it doesn't make sense that the actions don't work the same all the time.

I need one new record added in the subform every time the key is pressed.

Thanks.

I have a main form with a button add and a subform which is bounded to a given table.

I want the add button to work like this:
When add button is clicked, It has to set focus on the first column of the new record in the subform and then after the user enters data into all the columns in the subform , after entering the last value and pressing enter it must automatically load this into the table.

Could anyone pls help me out with a VBA code suitable with this ??

Hi all

I am trying to make some code to go to a new record in a sub form (called "frm_Each_Book_subform") from a command button.

Here is the code:

	Code:
	Private Sub cmd_New_Copy_Click()
frm_Each_Book_subform!Cost_Price.SetFocus 'sets the focus to cost_price in frm_Each_Book_subform
With frm_Each_Book_subformDoCmd.GoToRecord , Cost_Price, acNewRec  'Gos to the new recordEnd With
End Sub

the problem I am having is it works but it makes the master form go to a new record too, as well as making a blank record in the subform (called "frm_Each_Book_subform").

all I want is for the subform only to goto new record

Can anyone help me? Thanks you smarties

I have a subform showing a single record from a related table. I want to prevent the user from tabbing through the last control to create a new record.

Thanks,
DJ

Hi,
Is there any way to automatically have a subform only show the Add New Record window?

Basically, I want a form for Data input that will always only show the Add New Record screen without having to hit the >* very time?

I'm struggling through as a bit of a newbie, but after a weekend and a 865 page reference book, I'm making some headway, however this New Record bit isn;t working out very well.

Thanks,
Tim

I have a separate form setup in my database for new entries. On the main form I have a button called new entry. I want to write a code that allows me to open that form from the button. When the new entry form opens I want it to automatically open a new record in the table then once the user enters in the data they can press a button that closes that form. Any help is appreciated.

Thank you

As the title says I like to know in more detail how to copy certain fields of only a current record to a new record in a form.

I work on MS Access03 and have a database of client information.

Because I come accross many family members, storing one member's personal info and then again at the same time having to enter another member's personal info from the same family, there can be alot of similarities ofcourse with fields like Address, phones number, email etc. which is repetitive and could be avoided but I have very little knowledge of access.

So I dont know what code or event to use in my form to achieve this.

Any assistance please?

Thanks in advance

My main form is used to create new records in the 'input' table. there's an autonumber primary key, and then there's an enquiry_number field (syntax: E67xx). A secondary table tracks contact with clients, and the record to edit in the contact log is selected from a combo box.

what i'd like is to have a new record created with the enquiry_number field in the contact log filled in with each new enquiry number from the input table.

So, in the beforeinsert event in the input form (bound to the input table), i have the code that creates the new enquiry number. can i open a new record in the contact log table and insert the enquiry number into that new record in the same event? what's the code to switch tables, insert a new record, copy a value into the new record and switch back to the form?

any help is appreciated

I have access 2007 on a Win 7 computer, I have many entries and enter new records daily, I have to page down through many pages to get to New, is there some way that I can open to New every time I open access?

Thanks, Bob

I am doing pretty well with Access and have never had this come up before. At the bottom where you can click to go to new record...that button is greyed out, therefore i cannot go forward. I know this is very simple. The 'allow adds, deletes and edits' are all checked yes on my properties. Thanks for your help! ~j

Hi all

I would like to default the subform go to new record when the main form is opened. How can I do this? Thanks in advance

Hi All!
I am having the difficulty of going to a new record in my sub-sub form.

I have created a form (Annual Cks) that has nested in it a datasheetstyle subform (Notes).

When working on this form, I was able to create a button that used the DoCmd.GoToRecord , , acNew function. First, I set focus on the subform, and then called that "go to new record" function. It inserted a line into my subform "Notes". It worked like gravy

But when I dropped this form (Annual Cks) into a parent Form (Generator Overview), it messed it all up

Now when I click the button, it goes to a new record in Annual Cks, not in Notes! It still sets focus on the Notes SubSubForm, and records that data I instruct it to. But after going to a new record in Annual Cks.

Ok, so the DoCmd.GoToRecord function is now referring by default to the Annual Cks. So, I go to specify the subform in the call arguements. I get an error saying I'm referring to the wrong data type. (I specified dataform, and named the right form name). So I try to get a macro to do it. (That way I can view the VB code generated by the macro and see if I was wrong syntactically). But when I run the macro it says that the from isn't open! (Which, it is, in subsubform mode).

Frustratingly, when I have the curser on a line in the Notes Subsubform, I can go up to the menus accross the top and click on "add new record, Ctrl++" and it does insert a new line. In my head, if I can do it as a user... I SHOULD be able to do it with VB Code.

The only thing I can think that it is is something to do with the scope of the code. But I find that a bit confusing.

Does anyone have any suggestions?

Thanks so much!
Naomi

I am not the most knowledgeable with coding and have limped my way along to even get this far.

I have a continuous form that shows all of the records that are open in the db. I have a button on the continuous form that opens the main form to the specific record located in the subform on the main form.

The code I am using works fine for opening up the main form, but it does not open up to the correct record in the subform.

Here's the code I'm using:

Dim strWhere As String
Dim rs As DAO.Recordset
strWhere = "[Main_ClaimNo] = '" & Me![Main_ClaimNo] & "'"
DoCmd.OpenForm "frm_Main"
With Forms!frm_task (this is my subform)
Set rs = .RecordsetClone
rs.FindFirst strWhere (this is where VB is getting caught up)
If rs.NoMatch Then
MsgBox "Not found"
Else
.Bookmark = rs.Bookmark
End If
End With
Set rs = Nothing


Any help would be greatly appreciated as I have to have this working by tomorrow evening.

Cheers!

I have a bombo box that selects product details, once the details are selected a click button transfers the data from one form to another.

The problem i have is that when it transfers the data it keeps copying over the same record. What i need is it to appear as a new record in the subform i am transferring the data to.

Is there a function to do this? Here is my code so far.

Code:

	Code:
	 
Private Sub AddtoOrder_Click()
On Error GoTo Err_AddtoOrder_Click
 Me.Parent.F_Order_line_subform.Form.ProductID = Me.ProductID

Exit_AddtoOrder_Click:
    Exit Sub
Err_AddtoOrder_Click:
    MsgBox Err.Description
    Resume Exit_AddtoOrder_Click
    
End Sub

I know you can do 'RunCommand acCmdRecordsGotoNew', i am not sure where to place it. I tried under this line.


	Code:
	 
Me.Parent.F_Order_line_subform.Form.ProductID = Me.ProductID

But it just makes the form i am transferrng the data from go to a new record. Any help would be rgeat.

Thanks in advance!

I have main forn and on open event i have code


	Code:
	DoCmd.GoToRecord , , acNewRec

Now i also have subform in my main form. Is there any solution to open only main form in new record and my subform to retain value that it has? Or is there any solution to textbox in my subform go to first record in subform on open event

I have a form with a subform which goes to a new record for each upon opening.

I have a command button on the form to create a new record but it creates a new record on the in the subform rather than the main form. I imagine this is because the last place the curser is is the suborm.

I just need to specify go to new record for the main form.

How do I specify this?

Thanks

Hi,

I am having trouble getting Focus on a new record in a subform. I have used the GoToSubform Macro On Activate. If I open the subfrom separately then this works. The focus is on a new Record. However, When I open my main form and then click on my subform the focus does not go to the new record. I think what is happening is that it is going to the new record on the subform in total but not going to a new record on the subform relating to the record in the main form.

Can anyone help?

Ian

Hi guys,

I've got a problem with programmatically creating a new record in a subform from a different subform. Currently, the main form (frmMain) alternatively displays either subform 1 (sfrmSubform1) or subform 2 (sfrmSubform2), depending on what the user has selected. This switching is done via:
Forms!frmMain!container_form.SourceObject = "sfrmSubform1"
Where container_form is the name of the container holding either subform 1 or 2.

From subform 1 (i.e.: the VBA code-behind for subform 1), I'm trying to add a new record to subform 2. I've tried:
Forms!frmMain!container_form.SourceObject = "sfrmSubform2"
Forms!frmMain!container_form.Form.SetFocus
DoCmd.GoToRecord acActiveDataObject, , acNewRec
But this does not work. The runtime error I get is that sfrmSubform2 is not open.

Does anyone have any ideas how I can solve this?

Thanks,

Simon

I have an Access DB that uses forms to enter the data. One of the forms it has multiple tabs (subforms). All the subforms except the one in question have a one to one relationship. The one-to many (daily report) subform is giving me problems. Sometimes when I open the daily report and go to the end to add a new day I fill out the various fields and when I hit enter or page down it jumps back to the start of the records. Any idea how to always advance to the next or blank record rather than having to page down through all the days again? Or if I wanted to page up it should go to the previous day.
For some reason this does not happen all the time. Generally it is just the first time I start to enter data on a record that has lots of days.
Thanks!


Not finding an answer? Try a Google search.