 |
|
 |
GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 536
|
Re: excel,foxprow to access
Hi rdimky,
Your PM said
quote:
i have completed the first part of my project by combining two codes for converting excel and foxpro to access any how, but now the resulting ms access database contains two tables .I need to join these two table and need only one table so that i can use select queries for searching and updating that ONE table.I WANT ONLY ONE RESULTANT TABLE WHICH MUST BE UPDATABLE .if it is done than my project is done
Without knowing whats in your tables it is a bit difficult to say. Have you got two tables that are the same, but the information in them is different 'cos you imported from two different places? If that is the case then you run an Append Query in Access to move the data from one table into another, thereby ending up with just one table. However, if the fields in the two tables do not match then you could create a brand new table for the final result, then run two Append Queries, one for each of your existing tables, mapping the fields from each table to the relevant field in your new table. After both have been run then you will have all the data in one table. This may sound complicated but the Query Designer in Access makes it quite easy.
Hope that helps.
P.S. The good thing about Forums like this is that everyone gets to read all the posts - and thereby all visitors can benefit. If we keep the problems private in a message like this then nobody else can benefit, so I have copied this onto your original posting so that all can see. Of course, if you feel that a particular Forum member is likely to be able to help you then there is no reason why a private message should not be sent asking if they can look at a specific post.
Geoff
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|
|
17-02-2005 at 03:49 PM |
|
|
rdimky Level: Protégé
 Registered: 23-12-2004 Posts: 5
|
Re: excel,foxprow to access
thank u Geoff,
i actually was not knowing how to again ask the question that's why i have pm to u .i will try the query designer of access mean while i liked to know whether two tables can be joined into resultant table , if two tables contain similar named fields
i like to know the SQL query prefferably
thanks u again for urs generosity
|
|
17-02-2005 at 05:53 PM |
|
|
GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 536
|
Re: excel,foxprow to access
Hi rdimky,
You actually need 2 SQL statements to achieve this in Access, so the only way you can do that is to put a bit of code into a VBA Code module. Maybe a simple Form with a button on it, then you could use the Button_Click Event to run the code.
The code would first create a new Table from one of the existing tables, and insert all the data, the second SQL statement would then append into the new table all the data from the second table. If your first table contains an Autonumber Identity field then the new table will also get an Autonumber Identity field by inserting that field into the new table when it is created. Then when you append from the second table just leave that field out and the new records will get their own ID created for them.
Modify the following SQL Statements with your table and field names, then put it into your Form code module in the Button_Click Event, click and away you go!
Dim strSQL As String
strSQL = "SELECT Table1.Name_ID, Table1.FirstName, Table1.SecondName, Table1.Address_Street, Table1.Address_Town, Table1.Address_Code INTO Table3 FROM Table1"
DoCmd.RunSQL strSQL
strSQL = "INSERT INTO Table3 ( FirstName, SecondName, Address_Street, Address_Town, Address_Code ) " _
& "SELECT Table2.FirstName, Table2.SecondName, Table2.Address_Street, Table2.Address_Town, Address_Code FROM Table2"
DoCmd.RunSQL strSQL
|
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|
|
18-02-2005 at 12:12 PM |
|
|
|
|
 |
 |