How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Zabo04 Your Own Question

Zabo04
Zabo04, Computer Enthusiast
Category: Microsoft Office
Satisfied Customers: 283
Experience:  Experienced in Word, Excel, Access, Powerpoint, and Outlook.
58597962
Type Your Microsoft Office Question Here...
Zabo04 is online now
A new question is answered every 9 seconds

I have two tables in microsoft access. Table 1 has records

Customer Question

I have two tables in microsoft access. Table 1 has records with two fields. "Partial Name" and "account number". Sample. - rec1 Smith, 4433 rec 2 - miller, 1567 rec 3 Jones, 8765. Table has full names. Rec 1 - XXXXX XXXXX, Rec 2 - XXXXX XXXXX, rec 3 XXXXX XXXXX.

I want to have a query that would generate the results = XXXXX XXXXX, 4433 XXXXX XXXXX 1567, XXXXX XXXXX 8765. Is this possible.
Submitted: 5 years ago.
Category: Microsoft Office
Expert:  Zabo04 replied 5 years ago.

Zabo04 :

it is possible, but miller in table 1 probably needs to be Miller

Zabo04 :

In Table 2 full name would need to be split to first and last name

Zabo04 :

A better way is to have one table that has the full name and a customer ID, add the customer ID field to the table , remove the partial name from table 1. Link the two tables by customer ID, because, more than one user may have access to the same account if the account is a joint or company account.

Zabo04 :

Here is an access 2007 database with your example: http://www.mediafire.com/?5t5cmyc2j0ugjlx

Zabo04 :

First I had to define the relationship (linking the last name of table 2 to the partial name of table 1), look at the relationship to see that. Then I created a query, specifying that I wanted the first name, last name, from table 1 and account number from table 1.

Zabo04 :

let me know what else you want help on with this and exactly what you need beyond this current need and I'll give you some more advice.

JACUSTOMER-0qs4cg9b- :

This doesn't really help. The tables i have were given to me as is. There is no way practical way to parse into multiple fields as in your example. If there was, I wouldn't have had the original question, I just would have done that.

Zabo04 :

Then I'm sorry, there is no way to link the tables as you have defined them. You can still add a column to each table. What you need is a one account to multiple users external key, without some unique identifying key an E-R based database cannot perform its functions. The data you describe lacks such a key, so tales are unable to be joined as they stand.

Zabo04 :

Your only choice in this case is to create a user ID and link that between the accounts and users by adding that column in both tables, manually. Lots of work, but from the way you describe your tables, whoever set them up did you a severe disservice and you are going to be limited and this will probably not be your only limitation if you continue to develop this database.

Zabo04 :

I did find a way, using some SQL string functions to get the last name out of the Full Name in your table2, and use that to join against the partial name in Table1 to match account numbers.

Zabo04 :

You'll want to look at the query, and look at it in SQL view to see what's going on, the "where" clause of the select statement is the place that's most interesting.

Zabo04 :

That's all in the same query I had before, Accnt Query.

Zabo04 :

There is now a new query, called Separate Query. You'll notice I redesigned Table2, so that it has a First, Last, and Name column. Name is what you have now. First and Last you said you weren't given. If you add these two columns (which I already did), you can run a query to populate them by having it separate the first and last name by looking for the space. This is what the Separate Query does. This is called an update query, it updates the tables when it is run, Access will notify you "Warning you are about to update 3 record(s)", say okay to continue and the query will populate the first and last name columns. If you want to check it multiple times, just delete the first and last name records, then run the query again.

Zabo04 :

Here is the link to the access database: http://www.mediafire.com/?ad18bjbw5ad035l

Zabo04 :

Now, for security purposes, Access may disable the update query (Separate Query), because it has the ability to update a table, you will see a status bar in access below the normal toolbars that is giving you this warning. If you enable to that content, then the Separate Query will be able to run.