473,799 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform displaying existing record won't display new record

63 New Member
I have a subform which is bound to a query which will display records using an ID# supplied from a listbox in the parent form.

That same subform is also used to create new records using the following code in a "New Record" commandbutton:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord , , acNewRec
Both functions work fine. However, if I have a selected record displayed, and I click the "New Record" button, it does not move to a new record. It just stays on the selected record and any edits I make affect that selected record.

Any help you can provide is appreciated!
Jan 21 '09
21 7165
ChipR
1,287 Recognized Expert Top Contributor
From DataEntry Property:
The Data Entry property doesn't determine whether records can be added; it only determines whether existing records are displayed.
Jan 27 '09 #11
NeoPa
32,579 Recognized Expert Moderator MVP
@postman
I suggest that your solution possibly wasn't one then.

I would try looking at the .Requery route.
Jan 27 '09 #12
postman
63 New Member
@NeoPa
The .Requery route did not work.

After further testing, it appears to be a focus issue. I tried the earlier suggestions for moving the focus and I can't get the focus to move to the subform.

I even made test buttons on the parent form with code to just move the focus to a control on the subform and it won't work. The focus stays with the parent form. Not sure why that won't work.
Jan 27 '09 #13
NeoPa
32,579 Recognized Expert Moderator MVP
@postman
Could we see the code you tried.
Jan 27 '09 #14
postman
63 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command173_Click()
  3.  
  4.      Form_AttDetail.aiDate.SetFocus
  5.  
  6. End Sub
  7.  
Command173 is the command button in the parent form.
Form_AttDetail is the subform object.
aiDate is a control in that subform.

Thanks.
Jan 28 '09 #15
puppydogbuddy
1,923 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command173_Click() 
  2.  
  3.      Me!Form_AttDetail.Form!aiDate.SetFocus 
  4.  
  5. End Sub
  6.  
Jan 28 '09 #16
postman
63 New Member
@puppydogbuddy

It gives an error stating it "can't find the field 'Form_AttDetail ' referred to in your expression."

I tried changing it to
Expand|Select|Wrap|Line Numbers
  1. Me.attDetail.Form!aiDate.SetFocus
This eliminated the error, but nothing happens ("attDetail" is the subform control name and "AttDetail" is the subform name).
Jan 28 '09 #17
NeoPa
32,579 Recognized Expert Moderator MVP
Check out Referring to Items on a Sub-Form. I think it may explain the situation fully enough.

Let us know if you still have problems after reading through it.
Jan 28 '09 #18
puppydogbuddy
1,923 Recognized Expert Top Contributor
see the suggested syntax from the link I gave you in post #4
Expand|Select|Wrap|Line Numbers
  1. Me!attDetail.SetFocus
  2. Me!attDetail.Form!aiDate.SetFocus
  3.  
Jan 28 '09 #19
postman
63 New Member
@puppydogbuddy
Thanks. That did the trick.
The syntax I used was this:
Expand|Select|Wrap|Line Numbers
  1. Me.attDetail.SetFocus
  2. Form_AttDetail.aiDate.SetFocus
I use "Form_AttDetail " because it's shorter and the intellisense will display the controls/properties which means less typing. Using the the "!" method does not give the intellisense menus. Is there a disadvantage to this?

I still have to switch the recordsource of the subform to the table if I'm adding new records and to the query if I'm displaying records based on the listbox selection.

Thanks for all your help!
Jan 28 '09 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

0
8411
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 navigation buttons and a label showing Distribution 1 of ##. This is where the problem lies. The...
25
10273
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
6
5477
by: Tim Marshall | last post by:
Here's the situation. A form, frmSetUp, with a subform control called subExplain with a source object form frmSetUpSubDefineSides. The source object is a bound form, displaying a few records, no edit, adds, filters, etc, are permitted on the subform. An add or edit button on the subform is clicked opening an unbound form, frmSetUpSideAdd, (populated with values from the above subform if this is an edit of an existing record) for data...
4
7022
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
5
5262
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test box that is populated with the code =subfrm_media_review_sec_party.Form!first_name & " " & subfrm_media_review_sec_party.Form!last_name It works except that when I flip through the names it populates the parent form with the name of what ever...
5
2256
by: Thelma Lubkin | last post by:
I have a form/subform with the common one-to-many relationship. The form allows user to display records and move to other records via the selector, to add,delete, and edit them, with the related records displayed in the subform going along for the ride. The parent form's recordset has fields string integer COLORNAME CLASSSIZE and a few more that aren't relevant here.
20
10831
by: Robert | last post by:
Need some help to stop me going around in circles on this one.... Have a nested subform (subform2) which simulates a continuous form for the record on the parent subform. Subform2 has rows of either an option button plus two text fields or a checkbox plus two text fields Am wanting to save the user entries into an underlying table. Tag property for each option button, check box or text field has the value of the key
10
1730
by: sara | last post by:
Hi - I am developing a simple app, and just found a problem that I can't fix after 4 hours of trying. I display a list of customers, and the user chooses one and displays "orders". The frmOrders displays correctly, with the subform - frmOrders_sfrmCustInfo - on top that is correct. The subform displays cust info - name, address, phone. Name is from a function that takes
14
2351
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region & Credit Region. The subform displays the data/records. The record source for both my form and subform is driven by a query, which is the way I filter the records that the end user will see via another form I created. Everything is working fine but...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10225
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
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
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.