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

QUERY (vlookup fashioned)

Hi,
I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA

Thx.
Nov 18 '08 #1
9 3600
Sinner wrote:
Hi,
I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA

Thx.
There are some alternatives.

One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.

Or you open both Access and Excel and then cut and paste the values into
a table.

Or you could manually enter the data into the table.

Or you might try an Update query.

If you would supply some further background regarding your problem and
you might get a helpful answer.
Nov 18 '08 #2
On Nov 18, 9:05*pm, Salad <o...@vinegar.comwrote:
Sinner wrote:
Hi,
I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA
Thx.

There are some alternatives.

One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel..

Or you open both Access and Excel and then cut and paste the values into
a table.

Or you could manually enter the data into the table.

Or you might try an Update query.

If you would supply some further background regarding your problem and
you might get a helpful answer.
Hi,
The tableMAIN is as follows:

Fields are:
item date amount USER location
abc
abc
def
abc
xyz

UserlistTABLE is as follows:

Fields are:

user1 user2
abc ggg
def kkk
The result should yield:
item date amount USER location
ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)
Nov 19 '08 #3
Sinner wrote:
On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>Sinner wrote:
>>>Hi,
>>>I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA
>>>Thx.

There are some alternatives.

One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.

Or you open both Access and Excel and then cut and paste the values into
a table.

Or you could manually enter the data into the table.

Or you might try an Update query.

If you would supply some further background regarding your problem and
you might get a helpful answer.


Hi,
The tableMAIN is as follows:

Fields are:
item date amount USER location
abc
abc
def
abc
xyz

UserlistTABLE is as follows:

Fields are:

user1 user2
abc ggg
def kkk
The result should yield:
item date amount USER location
ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)
I really don't know how you'd do that. The userlist table has some user
ids and TableMain has no user ids...just some locations.

I did this as a test. I created table Z1. It had 1 field; UserName. I
had 2 records; A and C. I created table Z2. It had 2 fields; Username
and Location with 3 records A, B, and C. My query is this

UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");

The result was
A A
B N/A
C C

Normally you'd have 2 tables. Start by selecting
Query/New/FindUnmatched. You'd now have a list of records that don't
exist between both tables. Once you have this, select from the menu
Query/Update. Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.

But I really see no way, with the example above you provided, to link
the two tables together.
Nov 19 '08 #4
On Nov 19, 7:35*pm, Salad <o...@vinegar.comwrote:
Sinner wrote:
On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>Sinner wrote:
>>Hi,
>>I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA
>>Thx.
>There are some alternatives.
>One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.
>Or you open both Access and Excel and then cut and paste the values into
a table.
>Or you could manually enter the data into the table.
>Or you might try an Update query.
>If you would supply some further background regarding your problem and
you might get a helpful answer.
Hi,
The tableMAIN is as follows:
Fields are:
item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * * ** def
* * * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * * ** xyz
UserlistTABLE is as follows:
Fields are:
user1 * *user2
abc * * * *ggg
def * * * * kkk
The result should yield:
item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * * ** kkk
* * * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * * ** NA(NOT AVAILABLE)

I really don't know how you'd do that. *The userlist table has some user
ids and TableMain has no user ids...just some locations.

I did this as a test. *I created table Z1. *It had 1 field; UserName.*I
had 2 records; A and C. *I created table Z2. *It had 2 fields; Username
and Location with 3 records A, B, and C. *My query is this

UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");

The result was
* * * * A * * * A
* * * * B * * * N/A
* * * * C * * * C

Normally you'd have 2 tables. *Start by selecting
Query/New/FindUnmatched. *You'd now have a list of records that don't
exist between both tables. *Once you have this, select from the menu
Query/Update. *Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. *Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.

But I really see no way, with the example above you provided, to link
the two tables together.- Hide quoted text -

- Show quoted text -
Hi,

Thx for your reply.
A sample of my requirement is at link below.
http://www.savefile.com/files/1893950

I have worked around making a calculated field & then union will rest
of the tables to achieve what I was looking for.
Still I need to be able to get the 'N'A in case I don't match an IDor
if its blank. Also I would like to see if required IDs already exist,
it should skip it & check next & do the necessary thing.

Thx.
Nov 19 '08 #5
Sinner wrote:
On Nov 19, 7:35 pm, Salad <o...@vinegar.comwrote:
>>Sinner wrote:
>>>On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>>>Sinner wrote:
>>>>>Hi,
>>>>>I have a field name 'USER' in tableMAIN.
>How do I replace the user names with corresponding user names. I can
>do that in xl using vlookup but now I'm trying to find a way to do
>that in access.
>For a user mismatch, it should give NA
>>>>>Thx.
>>>>There are some alternatives.
>>>>One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.
>>>>Or you open both Access and Excel and then cut and paste the values into
a table.
>>>>Or you could manually enter the data into the table.
>>>>Or you might try an Update query.
>>>>If you would supply some further background regarding your problem and
you might get a helpful answer.
>>>Hi,
The tableMAIN is as follows:
>>>Fields are:
item date amount USER location
abc
abc
def
abc
xyz
>>>UserlistTABLE is as follows:
>>>Fields are:
>>>user1 user2
abc ggg
def kkk
>>>The result should yield:
>>>item date amount USER location
ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)

I really don't know how you'd do that. The userlist table has some user
ids and TableMain has no user ids...just some locations.

I did this as a test. I created table Z1. It had 1 field; UserName. I
had 2 records; A and C. I created table Z2. It had 2 fields; Username
and Location with 3 records A, B, and C. My query is this

UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");

The result was
A A
B N/A
C C

Normally you'd have 2 tables. Start by selecting
Query/New/FindUnmatched. You'd now have a list of records that don't
exist between both tables. Once you have this, select from the menu
Query/Update. Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.

But I really see no way, with the example above you provided, to link
the two tables together.- Hide quoted text -

- Show quoted text -


Hi,

Thx for your reply.
A sample of my requirement is at link below.
http://www.savefile.com/files/1893950
You should tell people to skip the ad.
I have worked around making a calculated field & then union will rest
of the tables to achieve what I was looking for.
Still I need to be able to get the 'N'A in case I don't match an IDor
if its blank. Also I would like to see if required IDs already exist,
it should skip it & check next & do the necessary thing.

Thx.
I looked at your Excel spreadsheet. I haven't a clue as to what you are
attempting to do. Is this an IQ or aptitude test or something for Mensa
members to figure out?

There's an excellent children's book, also good reading for adults,
called "The Phantom Tollbooth". Milo, the hero of the story, is on an
errand to save Rhyme and Reason. He heads into the Mountains of
Ignorance and meets a stranger along the way asking for some help. The
stranger wants Milo to fill up a hole from a pile of sand a few feet
away. But he must use a tweezer to move the sand to a hole. After many
hours of putting a grain of sand inbetween the tweezer blades and
carrying the grain to the hole Milo calculates the time it will take to
fill that hole and it is a long, long time. And the stranger had many
more tasks similar to that one to do and Milo could help him out. Milo
had met one of the many monsters in those mountains, an amiable person
but a time waster. You remind me of that character.

If you can't describe your problem, if you send people to web sites
without instructions on how to view your file, you aren't going to get
much help here when you waste people's time.

Nobody here knows if you have linked the spreadsheet to your Access
database, if you know what an update query is, if you know what an
append query is, if you have a clue about Access or databases or
programming or logic or VBA, or if you even know what you are doing or
attempting to accomplish. If you expect us to extract a nugget of
information from you in each post, playing Mindreading 101, and hoping
to get closer to your solution over many days of extraction, I expect
you'll be waiting a long time for any solution.

Nov 19 '08 #6
On Nov 19, 10:43*pm, Salad <o...@vinegar.comwrote:
Sinner wrote:
On Nov 19, 7:35 pm, Salad <o...@vinegar.comwrote:
>Sinner wrote:
>>On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>>Sinner wrote:
>>>>Hi,
>>>>I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA
>>>>Thx.
>>>There are some alternatives.
>>>One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.
>>>Or you open both Access and Excel and then cut and paste the values into
a table.
>>>Or you could manually enter the data into the table.
>>>Or you might try an Update query.
>>>If you would supply some further background regarding your problem and
you might get a helpful answer.
>>Hi,
The tableMAIN is as follows:
>>Fields are:
item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * * * *abc
* * * * * * * * * * * * * * * * * * *abc
* * * * * * * * * * * * * * * * * * *def
* * * * * * * * * * * * * * * * * * *abc
* * * * * * * * * * * * * * * * * * *xyz
>>UserlistTABLE is as follows:
>>Fields are:
>>user1 * *user2
abc * * * *ggg
def * * * * kkk
>>The result should yield:
>>item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * * * *ggg
* * * * * * * * * * * * * * * * * * *ggg
* * * * * * * * * * * * * * * * * * *kkk
* * * * * * * * * * * * * * * * * * *ggg
* * * * * * * * * * * * * * * * * * *NA(NOT AVAILABLE)
>I really don't know how you'd do that. *The userlist table has some user
ids and TableMain has no user ids...just some locations.
>I did this as a test. *I created table Z1. *It had 1 field; UserName. *I
had 2 records; A and C. *I created table Z2. *It had 2 fields; Username
and Location with 3 records A, B, and C. *My query is this
>UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");
>The result was
* * * *A * * * A
* * * *B * * * N/A
* * * *C * * * C
>Normally you'd have 2 tables. *Start by selecting
Query/New/FindUnmatched. *You'd now have a list of records that don't
exist between both tables. *Once you have this, select from the menu
Query/Update. *Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. *Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.
>But I really see no way, with the example above you provided, to link
the two tables together.- Hide quoted text -
>- Show quoted text -
Hi,
Thx for your reply.
A sample of my requirement is at link below.
http://www.savefile.com/files/1893950

You should tell people to skip the ad.
I have worked around making a calculated field & then union will rest
of the tables to achieve what I was looking for.
Still I need to be able to get the 'N'A in case I don't match an IDor
if its blank. Also I would like to see if required IDs already exist,
it should skip it & check next & do the necessary thing.
Thx.

I looked at your Excel spreadsheet. *I haven't a clue as to what you are
attempting to do. *Is this an IQ or aptitude test or something for Mensa
members to figure out?

There's an excellent children's book, also good reading for adults,
called "The Phantom Tollbooth". *Milo, the hero of the story, is on an
errand to save Rhyme and Reason. *He heads into the Mountains of
Ignorance and meets a stranger along the way asking for some help. *The
stranger wants Milo to fill up a hole from a pile of sand a few feet
away. *But he must use a tweezer to move the sand to a hole. *After many
hours of putting a grain of sand inbetween the tweezer blades and
carrying the grain to the hole Milo calculates the time it will take to
fill that hole and it is a long, long time. *And the stranger had many
more tasks similar to that one to do and Milo could help him out. *Milo
had met one of the many monsters in those mountains, an amiable person
but a time waster. *You remind me of that character.

If you can't describe your problem, if you send people to web sites
without instructions on how to view your file, you aren't going to get
much help here when you waste people's time.

Nobody here knows if you have linked the spreadsheet to your Access
database, if you know what an update query is, if you know what an
append query is, if you have a clue about Access or databases or
programming or logic or VBA, or if you even know what you are doing or
attempting to accomplish. *If you expect us to extract a nugget of
information from you in each post, playing Mindreading 101, and hoping
to get closer to your solution over many days of extraction, I expect
you'll be waiting a long time for any solution.- Hide quoted text -

- Show quoted text -
Hi,

Simply put, the xl sheet that I sent is NOT LINKED TO ACCESS.
It is just an example, a snap shot of what I was trying to do in
access.

tableMAIN sheet is actually the name of table in access.
userlistTABLE is actually the name of a table in access.
Result sheet is the required query in access.

Story was good.
I didn't know it was that hard to download a simple file from that
link.. silly.
Nov 20 '08 #7
Sinner wrote:
On Nov 19, 10:43 pm, Salad <o...@vinegar.comwrote:
>>Sinner wrote:
>>>On Nov 19, 7:35 pm, Salad <o...@vinegar.comwrote:
>>>>Sinner wrote:
>>>>>On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>>>>>Sinner wrote:
>>>>>>>Hi,
>>>>>>>I have a field name 'USER' in tableMAIN.
>>>How do I replace the user names with corresponding user names. I can
>>>do that in xl using vlookup but now I'm trying to find a way to do
>>>that in access.
>>>For a user mismatch, it should give NA
>>>>>>>Thx.
>>>>>>There are some alternatives.
>>>>>>One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.
>>>>>>Or you open both Access and Excel and then cut and paste the values into
>>a table.
>>>>>>Or you could manually enter the data into the table.
>>>>>>Or you might try an Update query.
>>>>>>If you would supply some further background regarding your problem and
>>you might get a helpful answer.
>>>>>Hi,
>The tableMAIN is as follows:
>>>>>Fields are:
>item date amount USER location
abc
abc
def
abc
xyz
>>>>>UserlistTABLE is as follows:
>>>>>Fields are:
>>>>>user1 user2
>abc ggg
>def kkk
>>>>>The result should yield:
>>>>>item date amount USER location
ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)
>>>>I really don't know how you'd do that. The userlist table has some user
ids and TableMain has no user ids...just some locations.
>>>>I did this as a test. I created table Z1. It had 1 field; UserName. I
had 2 records; A and C. I created table Z2. It had 2 fields; Username
and Location with 3 records A, B, and C. My query is this
>>>>UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");
>>>>The result was
A A
B N/A
C C
>>>>Normally you'd have 2 tables. Start by selecting
Query/New/FindUnmatched. You'd now have a list of records that don't
exist between both tables. Once you have this, select from the menu
Query/Update. Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.
>>>>But I really see no way, with the example above you provided, to link
the two tables together.- Hide quoted text -
>>>>- Show quoted text -
>>>Hi,
>>>Thx for your reply.
A sample of my requirement is at link below.
http://www.savefile.com/files/1893950

You should tell people to skip the ad.

>>>I have worked around making a calculated field & then union will rest
of the tables to achieve what I was looking for.
Still I need to be able to get the 'N'A in case I don't match an IDor
if its blank. Also I would like to see if required IDs already exist,
it should skip it & check next & do the necessary thing.
>>>Thx.

I looked at your Excel spreadsheet. I haven't a clue as to what you are
attempting to do. Is this an IQ or aptitude test or something for Mensa
members to figure out?

There's an excellent children's book, also good reading for adults,
called "The Phantom Tollbooth". Milo, the hero of the story, is on an
errand to save Rhyme and Reason. He heads into the Mountains of
Ignorance and meets a stranger along the way asking for some help. The
stranger wants Milo to fill up a hole from a pile of sand a few feet
away. But he must use a tweezer to move the sand to a hole. After many
hours of putting a grain of sand inbetween the tweezer blades and
carrying the grain to the hole Milo calculates the time it will take to
fill that hole and it is a long, long time. And the stranger had many
more tasks similar to that one to do and Milo could help him out. Milo
had met one of the many monsters in those mountains, an amiable person
but a time waster. You remind me of that character.

If you can't describe your problem, if you send people to web sites
without instructions on how to view your file, you aren't going to get
much help here when you waste people's time.

Nobody here knows if you have linked the spreadsheet to your Access
database, if you know what an update query is, if you know what an
append query is, if you have a clue about Access or databases or
programming or logic or VBA, or if you even know what you are doing or
attempting to accomplish. If you expect us to extract a nugget of
information from you in each post, playing Mindreading 101, and hoping
to get closer to your solution over many days of extraction, I expect
you'll be waiting a long time for any solution.- Hide quoted text -

- Show quoted text -


Hi,

Simply put, the xl sheet that I sent is NOT LINKED TO ACCESS.
It is just an example, a snap shot of what I was trying to do in
access.
And what are you trying to do?
You have
abc ggg
def kkk

and that somehow becomes

ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)

in column location. No rhyme or reason. Nothing to link the two tables
together.
>
tableMAIN sheet is actually the name of table in access.
userlistTABLE is actually the name of a table in access.
Result sheet is the required query in access.

Story was good.
I didn't know it was that hard to download a simple file from that
link.. silly.
Let people know you aren't selling web site designs. Stop ads. Etc.
Nov 20 '08 #8
On Nov 20, 7:59*pm, Salad <o...@vinegar.comwrote:
Sinner wrote:
On Nov 19, 10:43 pm, Salad <o...@vinegar.comwrote:
>Sinner wrote:
>>On Nov 19, 7:35 pm, Salad <o...@vinegar.comwrote:
>>>Sinner wrote:
>>>>On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>>>>Sinner wrote:
>>>>>>Hi,
>>>>>>I have a field name 'USER' in tableMAIN.
>>How do I replace the user names with corresponding user names. I can
>>do that in xl using vlookup but now I'm trying to find a way to do
>>that in access.
>>For a user mismatch, it should give NA
>>>>>>Thx.
>>>>>There are some alternatives.
>>>>>One way is to use Docmd.TransferSpreadsheet and then use Vlookup inExcel.
>>>>>Or you open both Access and Excel and then cut and paste the valuesinto
>a table.
>>>>>Or you could manually enter the data into the table.
>>>>>Or you might try an Update query.
>>>>>If you would supply some further background regarding your problem and
>you might get a helpful answer.
>>>>Hi,
The tableMAIN is as follows:
>>>>Fields are:
item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * ** def
* * * * * * * * * * * * * * * * ** abc
* * * * * * * * * * * * * * * * ** xyz
>>>>UserlistTABLE is as follows:
>>>>Fields are:
>>>>user1 * *user2
abc * * * *ggg
def * * * * kkk
>>>>The result should yield:
>>>>item * *date * * *amount * USER * *location
* * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * ** kkk
* * * * * * * * * * * * * * * * ** ggg
* * * * * * * * * * * * * * * * ** NA(NOT AVAILABLE)
>>>I really don't know how you'd do that. *The userlist table has someuser
ids and TableMain has no user ids...just some locations.
>>>I did this as a test. *I created table Z1. *It had 1 field; UserName. *I
had 2 records; A and C. *I created table Z2. *It had 2 fields; Username
and Location with 3 records A, B, and C. *My query is this
>>>UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location=
IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");
>>>The result was
* * * A * * * A
* * * B * * * N/A
* * * C * * * C
>>>Normally you'd have 2 tables. *Start by selecting
Query/New/FindUnmatched. *You'd now have a list of records that don't
exist between both tables. *Once you have this, select from the menu
Query/Update. *Now using the above IIF() statement as a template, change
it to suite your needs and removed the column with the ISNULL() criteria
row. *Before you do this, because you are unfamiliar with this stuff,
make a backup of your tables before you run the query.
>>>But I really see no way, with the example above you provided, to link
the two tables together.- Hide quoted text -
>>>- Show quoted text -
>>Hi,
>>Thx for your reply.
A sample of my requirement is at link below.
http://www.savefile.com/files/1893950
>You should tell people to skip the ad.
>>I have worked around making a calculated field & then union will rest
of the tables to achieve what I was looking for.
Still I need to be able to get the 'N'A in case I don't match an IDor
if its blank. Also I would like to see if required IDs already exist,
it should skip it & check next & do the necessary thing.
>>Thx.
>I looked at your Excel spreadsheet. *I haven't a clue as to what you are
attempting to do. *Is this an IQ or aptitude test or something for Mensa
members to figure out?
>There's an excellent children's book, also good reading for adults,
called "The Phantom Tollbooth". *Milo, the hero of the story, is on an
errand to save Rhyme and Reason. *He heads into the Mountains of
Ignorance and meets a stranger along the way asking for some help. *The
stranger wants Milo to fill up a hole from a pile of sand a few feet
away. *But he must use a tweezer to move the sand to a hole. *Aftermany
hours of putting a grain of sand inbetween the tweezer blades and
carrying the grain to the hole Milo calculates the time it will take to
fill that hole and it is a long, long time. *And the stranger had many
more tasks similar to that one to do and Milo could help him out. *Milo
had met one of the many monsters in those mountains, an amiable person
but a time waster. *You remind me of that character.
>If you can't describe your problem, if you send people to web sites
without instructions on how to view your file, you aren't going to get
much help here when you waste people's time.
>Nobody here knows if you have linked the spreadsheet to your Access
database, if you know what an update query is, if you know what an
append query is, if you have a clue about Access or databases or
programming or logic or VBA, or if you even know what you are doing or
attempting to accomplish. *If you expect us to extract a nugget of
information from you in each post, playing Mindreading 101, and hoping
to get closer to your solution over many days of extraction, I expect
you'll be waiting a long time for any solution.- Hide quoted text -
>- Show quoted text -
Hi,
Simply put, the xl sheet that I sent is NOT LINKED TO ACCESS.
It is just an example, a snap shot of what I was trying to do in
access.

And what are you trying to do?
You have
abc * * * *ggg
def * * * *kkk

and that somehow becomes

ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)

in column location. *No rhyme or reason. *Nothing to link the two tables
together.
tableMAIN sheet is actually the name of table in access.
userlistTABLE is actually the name of a table in access.
Result sheet is the required query in access.
Story was good.
I didn't know it was that hard to download a simple file from that
link.. silly.

Let people know you aren't selling web site designs. *Stop ads. *Etc.- Hide quoted text -

- Show quoted text -
I don't want anything in location. Not in column location. Why u keep
looking at location column?? It has nothing to do with location
column.

If I have a user name 'abc' in main table, in new query I want to
return ggg instead as per details because abc=ggg.
How do I make that query? Simple now?? common in both tables is abc
etc names.

What i have done is:

SELECT userlistTABLE.[USER2] AS [USER1], [tablemain].item,
[tablemain].date, [tablemain].amount, [tablemain].location
FROM tablemain LEFT JOIN userlist ON TABLEMAIN.[USER] = userlistTABLE.
[user1];

Having done that, now I want to get NA for a missing TABLEMAIN.USER
(from userlisttable where it looks at user1 and is getting user2 for a
match).

Hope its clear now.
Nov 20 '08 #9
Sinner wrote:
On Nov 20, 7:59 pm, Salad <o...@vinegar.comwrote:
>>Sinner wrote:
>>>On Nov 19, 10:43 pm, Salad <o...@vinegar.comwrote:
>>>>Sinner wrote:
>>>>>On Nov 19, 7:35 pm, Salad <o...@vinegar.comwrote:
>>>>>>Sinner wrote:
>>>>>>>On Nov 18, 9:05 pm, Salad <o...@vinegar.comwrote:
>>>>>>>>Sinner wrote:
>>>>>>>>>Hi,
>>>>>>>>>I have a field name 'USER' in tableMAIN.
>>>>>How do I replace the user names with corresponding user names. I can
>>>>>do that in xl using vlookup but now I'm trying to find a way to do
>>>>>that in access.
>>>>>For a user mismatch, it should give NA
>>>>>>>>>Thx.
>>>>>>>>There are some alternatives.
>>>>>>>>One way is to use Docmd.TransferSpreadsheet and then use Vlookup in Excel.
>>>>>>>>Or you open both Access and Excel and then cut and paste the values into
>>>>a table.
>>>>>>>>Or you could manually enter the data into the table.
>>>>>>>>Or you might try an Update query.
>>>>>>>>If you would supply some further background regarding your problem and
>>>>you might get a helpful answer.
>>>>>>>Hi,
>>>The tableMAIN is as follows:
>>>>>>>Fields are:
>>>item date amount USER location
>> abc
>> abc
>> def
>> abc
>> xyz
>>>>>>>UserlistTABLE is as follows:
>>>>>>>Fields are:
>>>>>>>user1 user2
>>>abc ggg
>>>def kkk
>>>>>>>The result should yield:
>>>>>>>item date amount USER location
>> ggg
>> ggg
>> kkk
>> ggg
>> NA(NOT AVAILABLE)
>>>>>>I really don't know how you'd do that. The userlist table has some user
>>ids and TableMain has no user ids...just some locations.
>>>>>>I did this as a test. I created table Z1. It had 1 field; UserName. I
>>had 2 records; A and C. I created table Z2. It had 2 fields; Username
>>and Location with 3 records A, B, and C. My query is this
>>>>>>UPDATE z2 LEFT JOIN z1 ON z2.UserName = z1.UserName SET z2.Location =
>>IIf(Not IsNull([Z1]![UserName]),[Z1]![UserName],"N/A");
>>>>>>The result was
> A A
> B N/A
> C C
>>>>>>Normally you'd have 2 tables. Start by selecting
>>Query/New/FindUnmatched. You'd now have a list of records that don't
>>exist between both tables. Once you have this, select from the menu
>>Query/Update. Now using the above IIF() statement as a template, change
>>it to suite your needs and removed the column with the ISNULL() criteria
>>row. Before you do this, because you are unfamiliar with this stuff,
>>make a backup of your tables before you run the query.
>>>>>>But I really see no way, with the example above you provided, to link
>>the two tables together.- Hide quoted text -
>>>>>>- Show quoted text -
>>>>>Hi,
>>>>>Thx for your reply.
>A sample of my requirement is at link below.
>http://www.savefile.com/files/1893950
>>>>You should tell people to skip the ad.
>>>>>I have worked around making a calculated field & then union will rest
>of the tables to achieve what I was looking for.
>Still I need to be able to get the 'N'A in case I don't match an IDor
>if its blank. Also I would like to see if required IDs already exist,
>it should skip it & check next & do the necessary thing.
>>>>>Thx.
>>>>I looked at your Excel spreadsheet. I haven't a clue as to what you are
attempting to do. Is this an IQ or aptitude test or something for Mensa
members to figure out?
>>>>There's an excellent children's book, also good reading for adults,
called "The Phantom Tollbooth". Milo, the hero of the story, is on an
errand to save Rhyme and Reason. He heads into the Mountains of
Ignorance and meets a stranger along the way asking for some help. The
stranger wants Milo to fill up a hole from a pile of sand a few feet
away. But he must use a tweezer to move the sand to a hole. After many
hours of putting a grain of sand inbetween the tweezer blades and
carrying the grain to the hole Milo calculates the time it will take to
fill that hole and it is a long, long time. And the stranger had many
more tasks similar to that one to do and Milo could help him out. Milo
had met one of the many monsters in those mountains, an amiable person
but a time waster. You remind me of that character.
>>>>If you can't describe your problem, if you send people to web sites
without instructions on how to view your file, you aren't going to get
much help here when you waste people's time.
>>>>Nobody here knows if you have linked the spreadsheet to your Access
database, if you know what an update query is, if you know what an
append query is, if you have a clue about Access or databases or
programming or logic or VBA, or if you even know what you are doing or
attempting to accomplish. If you expect us to extract a nugget of
information from you in each post, playing Mindreading 101, and hoping
to get closer to your solution over many days of extraction, I expect
you'll be waiting a long time for any solution.- Hide quoted text -
>>>>- Show quoted text -
>>>Hi,
>>>Simply put, the xl sheet that I sent is NOT LINKED TO ACCESS.
It is just an example, a snap shot of what I was trying to do in
access.

And what are you trying to do?
You have
abc ggg
def kkk

and that somehow becomes

ggg
ggg
kkk
ggg
NA(NOT AVAILABLE)

in column location. No rhyme or reason. Nothing to link the two tables
together.

>>>tableMAIN sheet is actually the name of table in access.
userlistTABLE is actually the name of a table in access.
>>>Result sheet is the required query in access.
>>>Story was good.
I didn't know it was that hard to download a simple file from that
link.. silly.

Let people know you aren't selling web site designs. Stop ads. Etc.- Hide quoted text -

- Show quoted text -


I don't want anything in location. Not in column location. Why u keep
looking at location column?? It has nothing to do with location
column.
In my email app your column data was f'd up, the usernames appeared
under location. All other columns were blank. Next time use a text
file and remove unnecessary crap from your posts. Anyway, I had
patience with you and the solutions are at the bottom.
>
If I have a user name 'abc' in main table, in new query I want to
return ggg instead as per details because abc=ggg.
How do I make that query? Simple now?? common in both tables is abc
etc names.

What i have done is:

SELECT userlistTABLE.[USER2] AS [USER1], [tablemain].item,
[tablemain].date, [tablemain].amount, [tablemain].location
FROM tablemain LEFT JOIN userlist ON TABLEMAIN.[USER] = userlistTABLE.
[user1];

Having done that, now I want to get NA for a missing TABLEMAIN.USER
(from userlisttable where it looks at user1 and is getting user2 for a
match).

Hope its clear now.
This example does not update the data, it simply displays the current
user and the new/real user. Copy/paste into a query to test.
SELECT tblMain.User, IIf(Not IsNull([user1]),[User2],"N/A") AS RealUser
FROM tblMain LEFT JOIN UserList ON tblMain.User = UserList.User1;

This example updates TableMain with the new values. Make a backup of
TableMain first before running it.
UPDATE tblMain LEFT JOIN UserList ON tblMain.User = UserList.User1 SET
tblMain.User = IIf(Not IsNull([user1]),[User2],"N/A");
Nov 20 '08 #10

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

Similar topics

2
by: chudson007 | last post by:
I've got a data set on which I'm trying to perform the same as excel's vlookup formula using SQL, but do not know how. Can anyone help? If you picture me having two tables Table_A and Table_B and...
3
by: Fred | last post by:
I am trying to come up with a way to lookup values in Access as easily as I can in Excel. My application is looking up scores. An example lookup table below explains what I'm after: TABLE1...
3
by: Fred | last post by:
I have an application that involves calculating a score based on a number of defects. Simplified example of the scoring: No_Defects Score 1-3 A 4-15 ...
2
by: Rebecca | last post by:
could someone tell me the correct syntax for using vlookup in visual basic
1
by: Crash91 | last post by:
I am using this formula in my sheet =VLOOKUP(A10,table,2) A10 is a cell that has the function :Left(sheet1!"c10"), it contains the correct value needed for the lookup but its isnt working! Can...
2
by: mkennaugh | last post by:
I have two tables. One with a list of various dates and other data, the other with a Period No (1, 2, 3, etc) and then a start and end date field. I feel sure it should be fairly easy to do a...
5
by: catlover30 | last post by:
HI, I need help with excel VLOOKUP! I am at a new job and really trying to solve this without asking anyone at work, since they seem th expect me to know this. What I am trying to acheive is the...
4
by: ritheshtitu1982 | last post by:
Hi, I would like to perform Vlookup in access. Eg. I have two Tables Code table Code --- No { ------- 0 ...
1
by: scubasteve | last post by:
Looking up values from an Access table is simple. Simulating the 'Range Lookup' functionality from Excel's VLookup formula is a bit trickier. For those that aren't familiar with this, it allows...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.