Solved How do I move to a new record automatically in a subform (2 Viewers)

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
Hi there.

My records are filled from my combobox. The problem I am having is when I try to add the next record from my combobox it overwrites the first record in my subform. I must physically click on the asterisk(*) which is the next record to have a new record added. Any help please.

I have tried this but it is not working.

Me![frmStudentBooksSubform].SetFocus
DoCmd.GoToRecord , , acNext <------- this give me an error


1698946999608.png
 

Attachments

  • 1698946637802.png
    1698946637802.png
    25 KB · Views: 45

GPGeorge

Grover Park George
Local time
Today, 15:10
Joined
Nov 25, 2004
Messages
1,873
It sounds like the combo box is bound to the field in the table. "Searching combo boxes", or those used to select a record, should be unbound.

Is that your problem here?
 

ebs17

Well-known member
Local time
Tomorrow, 00:10
Joined
Feb 7, 2020
Messages
1,946
Code:
With Me.frmStudentBooksSubform.Form
   .Recordset.AddNew
   .txtFieldX = Me.cboSomething
   ' do more
End With
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
It sounds like the combo box is bound to the field in the table. "Searching combo boxes", or those used to select a record, should be unbound.

Is that your problem here?
Hi there

I am trying to accomplish the following. But everytime I must first go to the subform click on the empty row below before I can add a record from the combobox.
1698948916684.png
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
All I need is some code to to activate the the row with the asterisk(*).
 

GPGeorge

Grover Park George
Local time
Today, 15:10
Joined
Nov 25, 2004
Messages
1,873
I see. You want to add a record in a different table, one bound to the subform.
Why not put the combo box IN the subform instead of on the parent form? You'd have to change the subform from datasheet to continuous form view and design it to closely resemble the current datasheet, the task would be much more straightforward. There's no real value that I can see to keeping the combo box on the main form when it's intended only to manage the subform.
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
Me!cmbBookNoTitle.Value = ""

Me.frmStudentBooksSubform.Form.Recordset.AddNew

Getting an AddNew Error
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
The problem is I do not want to go and click on the asterisk(*) and then go back to the combobox to go select the item.
I want to select the items from the combobox quickly without going to the asterisk(*) on the subform and it must be added to the subform one after each other

Thanks for those trying to assist and helping me.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 17:10
Joined
Feb 28, 2001
Messages
27,188
Check the ribbon setting File >> Options >> Client Settings and check the settings for Editing, which control whether you navigate to a new field or a new record when you hit the tab key. Play with those settings.
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
Hello all. I think my problem looks like it is not understood properly so I simplify it. What code must I add to the button ADD NEW, which is on the parent form to got to a new new record in the subform please. This should be very easy for you guys. So I want the BLUE LINE current record to goto the line where the asterisk(*) the new record. Thanks
1699007155594.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:10
Joined
Sep 21, 2011
Messages
14,310
Hello all. I think my problem looks like it is not understood properly so I simplify it. What code must I add to the button ADD NEW, which is on the parent form to got to a new new record in the subform please. This should be very easy for you guys. So I want the BLUE LINE current record to goto the line where the asterisk(*) the new record. Thanks
View attachment 110742
Have you EVEN tried what was suggested in post #3?
 

Gasman

Enthusiastic Amateur
Local time
Today, 23:10
Joined
Sep 21, 2011
Messages
14,310
Hi there. I tried post #3 code in the ADD NEW button but the current focus does not go to the asterisk(*) for new record.
Tried setting focus to the subform?
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
Hi all. I want nothing to be added to the new record. I have code that will add the data in the new record. All I require is that the new record in the subform must get the focus and ready to accept the data. I hope this may help. Any suggestions. Thanks.
 

bmaccess

Member
Local time
Today, 15:10
Joined
Mar 4, 2016
Messages
78
If
Tried setting focus to the subform?
If I set the focus for the subform I think the first record will get the focus and not the new record Is this correct or is there a way for the new record to get the focus.
 

Users who are viewing this thread

Top Bottom