Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 January 18th, 2007, 03:04 AM
Authorized User
 
Join Date: Nov 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating a database with new records modified

Thank you mmcdonal for the information towards the subject. May I know a few things. I have three tables lets say Table A with fields;DonorID,Name, ************,Address( primary Key DonorID-datatype "text") , table B with fields; DonorID,UnitNumber,(Primary Key UnitNumber-datatype "text"), C with fields;SerialID,UnitNumber (primary key SerialID-datatype "Autonumber")
Table A is linked to Table B by "DonorID"
table B is Linked to table C by "UnitNumber"
This means that for every record to be complete data must be entered in the three tables. therefore, on downloading I need to down data from the three linked tables.

1. How do I create the Superkey in order to download data from say a laptop computer to update the main database on the main computer or what is the best way to do it?
2. How do I automate this procedure?


Bmulenga
__________________
Bmulenga
 
Old January 18th, 2007, 08:39 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You would either need to create a field in each table that is a concatenation of several fields to be your superkey (set to be indexed, duplicates No) or generate the key at runtime as part of your code. It might be easier to store the data, if the size of your database allows this.

In your table, create a field to hold this data. I am troubled that the DonorID is a text field. Do you want to make this an autonumber field? I might also add a DateCreated field and set the default to Date().

Anyway, on your data entry form, put the new field (Call it SupKeyA)and do this code on the Before Insert event (assuming you change DonorID to an autonumber data type):

Dim sKey as String

sKey = CStr(Me.DonorID) & "-" & Me.Name & "-" & CStr(Me.DateCreated)

Me.SupKeyA = sKey

This will add a unique superkey to the record. If you anticipate perhaps changing this person's name sometime in the future, you can also add this code to the Before Update event of the form.

Add this field (Maybe SupKeyA, SupKeyB, SupKeyC) and code to all your data entry forms.

How you update the main database depends on how the users are connecting, or if you are transferring the database file using a memory key, etc. Can you tell me more about how they are doing this?

The idea is that now you can loop through the central TableA, and compare each SupKeyA in the remote database to the SupKeyA field in the main table. If none are found, then copy it over. Then move on to TableB, etc.



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating a database with new records modified cont bright_mulenga Access 0 January 18th, 2007 10:59 AM
Updating a database with new records bright_mulenga Access 1 January 17th, 2007 11:53 AM
problem in updating records & finding records naveed77 VB Databases Basics 1 January 16th, 2007 12:12 PM
problem in updating records & finding records naveed77 VB How-To 1 January 16th, 2007 12:10 PM
Updating database records in ASP/ADO aismail3 Classic ASP Databases 5 September 16th, 2004 11:10 PM





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