473,396 Members | 1,933 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,396 software developers and data experts.

Synchronising Tables

Hi everyone

Having a slight problem synchronising tables in MS Access 2002.

I have two tables:

Products (StockCode*, Description, CostPrice, SellingPrice)

and

ProductsWorkTable(StockCode*, Description, CostPrice, SellingPrice)

Which contain a list of products kept by our company.

ProductsWorkTable is imported from a CSV file and contains the (most) up to
date list of products which may include new products, may have had products
removed (records added or deleted) and may have had the cost price and/or
selling price fields of certain records changed.

What I need to do is make Products add any new records found in
ProductsWorkTable and remove any products that are NOT in ProductsWorkTable
but still in Products. This I can do, it is running smoothly.

I also, however, need the CostPrice and SellingPrice of all records in
Products to match the CostPRice and SellingPrice fields of the appropriate
(changed) records in ProductsWorkTable.

As I said, the adding and removing is fine, but the changing of fields is a
mystery to me.

The basic idea is:

IF
Products.StockCode == ProductsWorkTable.StockCode
THEN {
IF
(Products.CostPrice NOTEQUALTO ProductsWorkTable.CostPrice) THEN
(Products.CostPrice = ProductsWorkTable.CostPrice)
AND/OR
IF
(Products.SellingPrice NOTEQUALTO ProductsWorkTable.SellingPrice) THEN
(Products.SellingPrice = ProductsWorkTable.SellingPrice)
}
Basically if the fields in products don't match those in ProductsWOrkTable
set them to match.

Is there any way for me to do this with an SQL query or even with VBA? If
VBA needed is there a quick and easy way? The pseudocode isn't that much
and for me to learn VBA in it's entirety may take me a while...

Sorry for the long post and thank you in advance.

Michael Thomas

Nov 13 '05 #1
1 1403
Michael Thomas wrote:
Hi everyone

Having a slight problem synchronising tables in MS Access 2002.

I have two tables:

Products (StockCode*, Description, CostPrice, SellingPrice)

and

ProductsWorkTable(StockCode*, Description, CostPrice, SellingPrice)

Which contain a list of products kept by our company.

ProductsWorkTable is imported from a CSV file and contains the (most) up to
date list of products which may include new products, may have had products
removed (records added or deleted) and may have had the cost price and/or
selling price fields of certain records changed.

What I need to do is make Products add any new records found in
ProductsWorkTable and remove any products that are NOT in ProductsWorkTable
but still in Products. This I can do, it is running smoothly.

I also, however, need the CostPrice and SellingPrice of all records in
Products to match the CostPRice and SellingPrice fields of the appropriate
(changed) records in ProductsWorkTable.

As I said, the adding and removing is fine, but the changing of fields is a
mystery to me.

The basic idea is:

IF
Products.StockCode == ProductsWorkTable.StockCode
THEN {
IF
(Products.CostPrice NOTEQUALTO ProductsWorkTable.CostPrice) THEN
(Products.CostPrice = ProductsWorkTable.CostPrice)
AND/OR
IF
(Products.SellingPrice NOTEQUALTO ProductsWorkTable.SellingPrice) THEN
(Products.SellingPrice = ProductsWorkTable.SellingPrice)
}
Basically if the fields in products don't match those in ProductsWOrkTable
set them to match.

Is there any way for me to do this with an SQL query or even with VBA? If
VBA needed is there a quick and easy way? The pseudocode isn't that much
and for me to learn VBA in it's entirety may take me a while...

Sorry for the long post and thank you in advance.

Michael Thomas


I would create an Unmatched record query...shows all records from Work
not in Products. Then create an append query to append all records
found in the unMatched query. This will synch the products.

Next create a query that links Work to Products. Drag the Products
price to the column. In the criteria, enter <>Work!Price. Then set the
query to Update. And enter Work!Price in the update row. (Please
substitute with your table/field names)
Nov 13 '05 #2

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

Similar topics

2
by: justme | last post by:
Dears I have created the following page to display my data <head> <style type="text/css"> body, td, th, h1, h2 {font-family: sans-serif;} body, td, th {font-size: 100%;} a:link {...
6
by: paulus4605 | last post by:
Dears I have the following problem I’m using a query to get all the data from my database from the past year the second query is displaying the results by month. How can I match the second...
1
by: Dominic Marks | last post by:
Hi, (I apologise if this is the wrong list, I haven't posted to a postgresql.org mailing list before, general seemed like a good catch-all) I am trying to implement a centralised...
1
by: judy | last post by:
I have a number of Acess databases on a web site and copies of these databases on my local PC. The databases can be independently updated on the web and also on my local PC. Is there some way...
1
by: naron | last post by:
Hi - I am building a DB from ms-access I have a simple GUI form to start with that allows basic data to be added for each unit built and buttons to bring up a separate comments field where...
1
by: Rajesh Sharma | last post by:
Dear all, please help me in Combo Box Synchronising. I have three levels. Category -> Type -> Subtype Depending on the selected Category, the Type appears in the second combo box and...
0
by: Chris Naylor | last post by:
Right, further to previous question not so long ago... I have a fairly complex access database that has a number of linked tables in it. The main table of this database is a details one that has...
0
by: adamjc | last post by:
Hi, I need to develop a program to synchronise tables in a local Access database with tables in a replica Access database on a central web server. Is the best way to do this with .Net? I can see a...
3
by: chromis | last post by:
Hi, I've just setup a development server for testing websites at my office and wish to synchronise it with the sites folder on our live server, does anyone know of any good programs for this? ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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,...

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.