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: - 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.
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.
@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.
NeoPa 32,579
Recognized Expert Moderator MVP @postman
Could we see the code you tried.
-
-
Private Sub Command173_Click()
-
-
Form_AttDetail.aiDate.SetFocus
-
-
End Sub
-
Command173 is the command button in the parent form. Form_AttDetail is the subform object. aiDate is a control in that subform.
Thanks.
-
Private Sub Command173_Click()
-
-
Me!Form_AttDetail.Form!aiDate.SetFocus
-
-
End Sub
-
@puppydogbuddy
It gives an error stating it " can't find the field 'Form_AttDetail ' referred to in your expression."
I tried changing it to - Me.attDetail.Form!aiDate.SetFocus
This eliminated the error, but nothing happens ("attDetail" is the subform control name and "AttDetail" is the subform name).
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.
see the suggested syntax from the link I gave you in post #4 -
Me!attDetail.SetFocus
-
Me!attDetail.Form!aiDate.SetFocus
-
@puppydogbuddy
Thanks. That did the trick.
The syntax I used was this: - Me.attDetail.SetFocus
-
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!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
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.
|
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
|
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
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |