473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Modifying subform records for cartesian product

Using A2K. I've got a database with client info and each client has a
subform which contains types of income and the amount they each
receive. The record source of the subform is a cartesian product of
the client ID and the types of income of which there is currently 16
types. So every client has 16 records.

What I'd like to do is to allow the user to modify a type from any
client's subform and the changes affect all clients. So if the user
wanted to change the income type "Worker's Comp" to "Worker's
Compensation", all they would have to do is change it on the current
client's subform and it would be changed for all client's.

I've got a SQL statement in the AfterUpdate event of the income type
field to modify the type:

strSQL = "UPDATE tblIncomeAtEntry SET
tblIncomeAtEntry.IncomeType = " & _
conQuote & Me.txtIncomeType & conQuote & " " & _
"WHERE (((tblIncomeAtEntry.IncomeType) = " & _
conQuote & Me.txtIncomeType.OldValue & conQuote & "));"
dbs.Execute strSQL, dbFailOnError

Modifying a type actually modifies the record but then it also modifies
the very first record in the subform, which is not a good thing.

Originally the SQL statement excluded the current client's ID #. The
SQL looked something like this: "AND tblIncomeAtEntry.ID <> <current
client ID #>"

Any suggestions or advice would be appreciated.

Nov 13 '05 #1
2 1679
<ma**********@hotmail.com> wrote
Using A2K. I've got a database with
client info and each client has a subform
which contains types of income and the
amount they each receive. The record
source of the subform is a cartesian product of
the client ID and the types of income of
which there is currently 16 types. So
every client has 16 records.

What I'd like to do is to allow the user
to modify a type from any client's subform
and the changes affect all clients. So if the user
wanted to change the income type "Worker's
Comp" to "Worker's Compensation", all they
would have to do is change it on the current
client's subform and it would be changed for
all client's.

I've got a SQL statement in the AfterUpdate
event of the income type field to modify the type:

strSQL = "UPDATE tblIncomeAtEntry SET
tblIncomeAtEntry.IncomeType = " & _
conQuote & Me.txtIncomeType & conQuote & " " & _
"WHERE (((tblIncomeAtEntry.IncomeType) = " & _
conQuote & Me.txtIncomeType.OldValue &_
conQuote & "));"
dbs.Execute strSQL, dbFailOnError

Modifying a type actually modifies the record
but then it also modifies the very first record
in the subform, which is not a good thing.


It is not clear to me why this would happen, based on the SQL you show. I am
assuming you mean that it happens even if the "very first record in the
subform" is something other than the record with the appropriate original
"type".

Does the _database_ itself get properly updated? Could it just be a matter
of your needing to Requery?

Larry Linson
Microsoft Access MVP

Nov 13 '05 #2
Thanks for your response. I see the problem. I update a lookup table
as well and wasn't editing the correct record in the lookup table.

Larry Linson wrote:
<ma**********@hotmail.com> wrote
> Using A2K. I've got a database with
> client info and each client has a subform
> which contains types of income and the
> amount they each receive. The record
> source of the subform is a cartesian product of
> the client ID and the types of income of
>which there is currently 16 types. So
> every client has 16 records.
>
> What I'd like to do is to allow the user
> to modify a type from any client's subform
> and the changes affect all clients. So if the user
> wanted to change the income type "Worker's
> Comp" to "Worker's Compensation", all they
> would have to do is change it on the current
> client's subform and it would be changed for
> all client's.
>
> I've got a SQL statement in the AfterUpdate
> event of the income type field to modify the type:
>
> strSQL = "UPDATE tblIncomeAtEntry SET
> tblIncomeAtEntry.IncomeType = " & _
> conQuote & Me.txtIncomeType & conQuote & " " & _
> "WHERE (((tblIncomeAtEntry.IncomeType) = " & _
> conQuote & Me.txtIncomeType.OldValue &_
> conQuote & "));"
> dbs.Execute strSQL, dbFailOnError
>
> Modifying a type actually modifies the record
> but then it also modifies the very first record
> in the subform, which is not a good thing.


It is not clear to me why this would happen, based on the SQL you show. I am
assuming you mean that it happens even if the "very first record in the
subform" is something other than the record with the appropriate original
"type".

Does the _database_ itself get properly updated? Could it just be a matter
of your needing to Requery?

Larry Linson
Microsoft Access MVP


Nov 13 '05 #3

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

Similar topics

7
by: Eric Slan | last post by:
Hello All: I'm having a problem that's been baffling me for a few days and I seek counsel here. I have an Access 2000 DB from which I want to run several reports. These reports are...
5
by: DS | last post by:
I have a form with 2 Subforms...The first subform is linked to the main form. The second Subform is liked to the first subform. Whenever I add a record to the first subform that works fine. When...
0
by: manning_news | last post by:
Using A2K. I've got a form for clients that has a subform that is a cartesian product between client ID and a lookup table for types of income. So each client has the exact same number of income...
20
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...
44
by: Christoph Zwerschke | last post by:
In Python, it is possible to multiply a string with a number: >>> "hello"*3 'hellohellohello' However, you can't multiply a string with another string: >>> 'hello'*'world' Traceback (most...
78
by: wkehowski | last post by:
The python code below generates a cartesian product subject to any logical combination of wildcard exclusions. For example, suppose I want to generate a cartesian product S^n, n>=3, of that...
4
by: virtualgreek | last post by:
Dear All, First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for...
14
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 &...
0
by: diogenes | last post by:
"Rick Brandt" <rickbrandt2@hotmail.comwrote in news:bPnKj.456$%41.325 @nlpi064.nbdc.sbc.com: I used this approach, and it works a treat! ID In(SELECT Order_ID FROM orderitems WHERE NAME =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.