Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2003, 05:16 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating Two Tables from Form Input

I created a form that updates a table. I would like that data to be updated to another table also. Can I do that in the form? Any other way?

PamS
 
Old October 29th, 2003, 07:07 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the relationship between one table and the other?

there are ways to do this, however, there may be a simpler way to fix the problem.
You can either do this by using append queries and a combination of find unmatched queries.

What are you trying to do?

Please also provide table structure.




Sal
 
Old October 30th, 2003, 11:24 AM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK - I am importing two reports that are missing two depts. During the import I create records for these depts and then want the user to key in the rest of the info (dollar amts). The key to file A is "A" + Dept + Date and the key to file D is "D" + Dept + Date, the only difference is the A or D. I made two tables because I have to subtract the "D" amts from the "A" amts for a report. (ALL minus DEBITs gives me CREDITS.) When the user keys in the amts I would like to update both tables. The entry form only shows the two missing depts. Should I create an append query to run after the form, or can I do an update query using data from one table to update the other table?

PamS
 
Old October 30th, 2003, 11:42 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If the only difference between the wto tables is the A andD fields, keep all of the info in one table. Your key will still be unique, because your A and D will make it unique. All you would have to do to get totals would be a big addition/substraction Sum(A)-Sum(B), and you would get the result. This may also simplify data entry.

I hope that makes sense.

Are there any other fields on each table that may be different from the other table? or contain different data?



Sal
 
Old October 30th, 2003, 12:21 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Even if I have the info in one file I still need the A and D record to be duplicated. How do I do that without keying in twice. The fields are all named the same (it's an AR aging report).
How do I subtract one record from another? Do I create a query to isolate the"A" and then another for the subtraction?

PamS
 
Old October 30th, 2003, 12:46 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do this tables have any referential integrity or other constraints?
The only way of doing this may be by using ADO to insert record to both tables. When a record is inserted to table A, a date is added. is this done by the user or by a default Date() value in the Date field? If this is done with a default value, chances are a record A could have a different date from record B on table B. By using ADO and unbound colums, you can set a variable date that gest inserted to both tables. the problem would be when a record is edited. Would you have to change the record on the other table as well? If yes, how do you compare both tables with different keys?

Do you know ADO? if not I will look for some samples for you.



Sal
 
Old October 30th, 2003, 02:46 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you create one table. Put the following fields, or equivalent fields

Dept
Date
AAmount
DAmount

you can create a query an insert a calculated field
NewField: [AAmount]-[DAmount]

And it will give you your result.

You are trying too hard by duplicating the info in two tables. One table is enough and it will not have any issues on joining one table to the other. Anyway, you may not even need to keep the A and D or two dates, or two dept.

Will this work for you?



Sal




Similar Threads
Thread Thread Starter Forum Replies Last Post
updating SQL tables leopardj Beginning PHP 2 January 29th, 2007 06:42 AM
Updating Tables Brendan Bartley Access 1 December 20th, 2006 10:42 AM
ADO - Updating two tables? BradLee31 Pro VB 6 2 May 19th, 2004 05:39 AM
Coding for data input from one form to 2 tables... dgarcia1128 Access VBA 1 February 19th, 2004 12:35 AM
Updating Multiple Tables with 1 Dreamweaver Form stephaniejones Dreamweaver (all versions) 0 July 9th, 2003 09:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.