What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND

MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
Author: Message:
mrsmfox
New Member
*


Posts: 3
Joined: Apr 2007
O.P. MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
I am trying to build a query in my MS Access database.  I am operating on Office 2000.  I have 2 tables that I am working with.  Both tables contain columns with identical information.  These identical fields are currently linked together as a subdatasheet under tables.  What I would like to do is create a query where, if the data from one table is identical to data in another table, then values are copied and pasted in to the main table.

Here is what I am talking about:

I have 2 tables:
1 = ISMCompany
2 = BPIncCompany

Both tables contain the identical fields "DepartmentName."  I am trying to bring data from table 2 over to table 1 and paste information from table 2 in the columns if the "DepartmentName" fields in both tables are identical.  I would think this would be a simple task:

Create an append query and append data to table 1 where the criteria is as follows:

"If [ISMCompany]![DepartmentName] = [BPIncCompany]![DepartmentName]"

I am pulling my hair out and have been trying to figure this out for over 12 hours now.  Someone, please please help!  It seems like it would be a simple problem to fix, but I just can't figure it out and I am going crazy! 
04-19-2007 06:54 PM
Profile E-Mail PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
Your explanation of your problem leaves much to be desired.  I have no idea what you are asking.

Do you wish to:

1) Update the other columns of rows in Table1 with values from rows in Table2 where DepartmentName matches?  Note that this will not add any new rows to Table1, only change what is already there.

2) Copy rows from Table 2 to Table1, but only if rows containing the same DepartmentName value already exist in Table1?

3) Something else?
04-19-2007 09:03 PM
Profile E-Mail PM Find Quote Report
mrsmfox
New Member
*


Posts: 3
Joined: Apr 2007
O.P. RE: MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
Yes to #1...sorry, I should be a little more clear.  I am so confused at this point!
04-19-2007 09:06 PM
Profile E-Mail PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
Ok.  Right click in Query Designer, select SQL view, and type the following (adjusting for your table and field names):

UPDATE Table1 INNER JOIN Table2 ON Table2.DepartmentName = Table1.DepartmentName SET Table1.Col1 = Table2.Col1, Table1.Col2 = Table2.Col2

You may, of course, have more than two columns you want to update.  I quickly tested it (since I normally work with SQL Server and Access only supports a subset of T-SQL) and it works.

I don't know whether or how you can create such a query in the drag-n-drop designer mode.  I noticed that after having it saved, Query Designer doesn't seem to be able to display it otherwise than just straight SQL.
04-19-2007 09:43 PM
Profile E-Mail PM Find Quote Report
mrsmfox
New Member
*


Posts: 3
Joined: Apr 2007
O.P. RE: MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
I tried it and I can't get it to work.  Any thoughts?
04-20-2007 02:23 AM
Profile E-Mail PM Find Quote Report
Adeptus
Senior Member
****


Posts: 732
Reputation: 40
Joined: Oct 2005
RE: MS ACCESS - SIMPLE PROBLEM I JUST CAN'T GET MY HEAD AROUND
As noted, I tested the query because I wanted to be certain I don't give you SQL that is beyond what Access supports.  I'd suspect you made some mistake while altering it for your situation (table names and columns).

What mistake specifically I couldn't even begin to guess.  If you can't spot it yourself you can cut and paste your version of the query here and I will look it over.  Also, it'd help to know how it fails (what error message you get).
04-20-2007 04:01 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On