473,493 Members | 4,347 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Subform Data entry problem

JJ
I have a MainForm/subform1/subform2 setup that I thought
was working but maybe I just hadn't tested it enough or
broke it as I added more features. The database has 2 main
tables: Companies and AgreementHistory. On my MainForm I
get the CompanyName from the Companies table. For subform1
I get the AId, and 3 date fields plus a calculated field from
a query based on the AgreementHistory table linking it to MainForm
using CompanyName. For subform2, I get the remainder of the
fields(12 total) also from the AgreementHistory table.
Subform1 and 2 are linked by the AId. Subform1 is
a continuous view form and the idea is that for the
current record you will see the details in subform2. The
OnCurrent code for subform1 is Me.Parent!
[subform2].Requery. When I add a new record in subform1 I
have a hidden control that sets focus to subform2 but when
I try to save details in subform2 I get a ".changes would
create duplicate values." error. If I click on another
record in subform1 or close the form I can come back and
enter the details into subform2.
Is it the Requery action that's causing me problems and
should it maybe not be activated for a new record or maybe
not on the OnCurrent event. Or worse, are my tables set up
wrong.I really need some assistance and my VBA skills are limited!
Thanks in advance.
Nov 13 '05 #1
5 2051
Since both subform1 and subform2 are based on the AgreementHistory table,
subform2 should not be nested in subform1. Rather subform1 and subform2
should be set up the same; both as subforms of the main form. Subform1
already is. Change the LinkMaster/Linkchild properties of Subform2 to
CompanyName same as Subform1. Delete the code you have in the current event
of Subform2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"JJ" <ch*****@hotmail.com> wrote in message
news:d9**************************@posting.google.c om...
I have a MainForm/subform1/subform2 setup that I thought
was working but maybe I just hadn't tested it enough or
broke it as I added more features. The database has 2 main
tables: Companies and AgreementHistory. On my MainForm I
get the CompanyName from the Companies table. For subform1
I get the AId, and 3 date fields plus a calculated field from
a query based on the AgreementHistory table linking it to MainForm
using CompanyName. For subform2, I get the remainder of the
fields(12 total) also from the AgreementHistory table.
Subform1 and 2 are linked by the AId. Subform1 is
a continuous view form and the idea is that for the
current record you will see the details in subform2. The
OnCurrent code for subform1 is Me.Parent!
[subform2].Requery. When I add a new record in subform1 I
have a hidden control that sets focus to subform2 but when
I try to save details in subform2 I get a ".changes would
create duplicate values." error. If I click on another
record in subform1 or close the form I can come back and
enter the details into subform2.
Is it the Requery action that's causing me problems and
should it maybe not be activated for a new record or maybe
not on the OnCurrent event. Or worse, are my tables set up
wrong.I really need some assistance and my VBA skills are limited!
Thanks in advance.

Nov 13 '05 #2
JJ
"PC Datasheet" <no****@nospam.spam> wrote in message news:<qK*****************@newsread2.news.atl.earth link.net>...
Since both subform1 and subform2 are based on the AgreementHistory table,
subform2 should not be nested in subform1. Rather subform1 and subform2
should be set up the same; both as subforms of the main form. Subform1
already is. Change the LinkMaster/Linkchild properties of Subform2 to
CompanyName same as Subform1. Delete the code you have in the current event
of Subform2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com


Thanks, I made the 2 changes you suggested but now the data in
subform2 does not change to reflect the current record in subform1. My
whole purpose here is to present a useable form that allows users to
see the summarized history(subform1) then see details in subform2 and
also allow them to enter a new record for a company . !###&^!!*****
Nov 13 '05 #3
Yes, I was wrong! Your tables need to look like:
TblCompanies
CompanyName - Primary Key
etc

TblAgreementHistory
AID
CompanyName
etc

Subform1 control on the main form needs to have LinkMaster/LinkChild
properties = CompanyName

Subform2 control on main form needs to have:
LinkMaster = NameOfSubform1Control.Form!AID
LinkChild = [AID]

The following code is needed in the Current event of Subform1:
Me.Parent!NameOfSubform1Control.Requery

"JJ" <ch*****@hotmail.com> wrote in message
news:d9************************@posting.google.com ...
"PC Datasheet" <no****@nospam.spam> wrote in message

news:<qK*****************@newsread2.news.atl.earth link.net>...
Since both subform1 and subform2 are based on the AgreementHistory table, subform2 should not be nested in subform1. Rather subform1 and subform2
should be set up the same; both as subforms of the main form. Subform1
already is. Change the LinkMaster/Linkchild properties of Subform2 to
CompanyName same as Subform1. Delete the code you have in the current event of Subform2.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com


Thanks, I made the 2 changes you suggested but now the data in
subform2 does not change to reflect the current record in subform1. My
whole purpose here is to present a useable form that allows users to
see the summarized history(subform1) then see details in subform2 and
also allow them to enter a new record for a company . !###&^!!*****

Nov 13 '05 #4
JJ
Tried that but a new problem arose. When I start typing an entry in
Subform2 I get the error, "You can't assign a value to this object.
*the object might be a control on a read-onlyfor. *The object may be
on a form that is open in Design view. *The value may be too large for
this field. But when I click ok, I can continue my data entry and save
the record.
Nov 13 '05 #5
JJ
ch*****@hotmail.com (JJ) wrote in message news:<d9**************************@posting.google. com>...
Tried that but a new problem arose. When I start typing an entry in
Subform2 I get the error, "You can't assign a value to this object.
*the object might be a control on a read-onlyfor. *The object may be
on a form that is open in Design view. *The value may be too large for
this field. But when I click ok, I can continue my data entry and save
the record.

--------------------------------------------------------------------------
Update to this error. Did more searching and found the following
suggestion:
Add these two lines to the Before Insert event of the subform:
Me.Recordset.AddNew
Me.Recordset.Update

Appears to work but someone in the message thread did say that it
didn't
help them. If you have any info why this is not a good approach please
let me know. Thanks much
Nov 13 '05 #6

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

Similar topics

1
3033
by: Max Harvey | last post by:
Hi, I made up a nice little form which had its own sub form in it. I made a litle VB code so that when I pressed a button it would move form the form (frmConference) to the subform...
11
11506
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a...
25
10162
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...
4
6965
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...
1
2195
by: Trent | last post by:
I am in the design phase of a new database and am having a devil of a time with a subform. I have three tables that relate to problem - Suppliers tbl, Customers tbl and a SuppliersCustomers tbl....
5
5401
by: lottaviano | last post by:
I am using Access 2002 and have two tables (Main and Actions) linked (in Relationships) on one field "CAL_ID" (primary key in Main Table). Main Table is a list of equipment. Actions Table lists...
1
1628
by: Nick via AccessMonster.com | last post by:
Hello, I'm using a form that has a subform. The subform is linked to a hidden datasheet form, and the subform displays records from the form. The problem is, the subform will only show X...
2
2530
by: whitc26 | last post by:
Let me preface: I'm a novice, and have no programming experience. I have created an access database and have a few tables in it. I have created a form called "clients" This form opens up and...
3
7465
by: bosmatthews | last post by:
I have a main form with a subform and a second subform nested to the first subform. The data entry property for all three forms (main, subform and sub-subform) is set to "yes" because I am intending...
6
4246
by: VBANovice | last post by:
HI!!! I am in the process of building an Accounting Database. I have two tables. The first table is the Journal Entry Header and the second table contains the Journal Entry Details (the accounts...
0
7118
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,...
0
6980
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...
0
7157
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,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
3087
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
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 ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
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...

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.