A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Criteria from 2 fields to display one result



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2006, 06:53 PM posted to microsoft.public.access.queries
TKM
external usenet poster
 
Posts: 289
Default Criteria from 2 fields to display one result

I need to retreive a Transaction Type (field named HLP_TEXT) based from the
following two fields.

1. TR_NO (has 4 digits such as 3112, 4009 or any other 4 digits combinations)
2. HLP_CODE (has 5 digits isuch as 30003, 40034 or any other 5 digit combos)

Notice that the last digit of the HLP_CODE is the first digit of the TR_NO?
This number represents a Transaction Type. I need to place this in my
criteria so I can find a Transaction Type for the given TR_NO. I really need
a place to start with this one so any help is appreciated!
  #2  
Old October 4th, 2006, 08:27 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Criteria from 2 fields to display one result

TKM wrote:

I need to retreive a Transaction Type (field named HLP_TEXT) based from the
following two fields.

1. TR_NO (has 4 digits such as 3112, 4009 or any other 4 digits combinations)
2. HLP_CODE (has 5 digits isuch as 30003, 40034 or any other 5 digit combos)

Notice that the last digit of the HLP_CODE is the first digit of the TR_NO?
This number represents a Transaction Type. I need to place this in my
criteria so I can find a Transaction Type for the given TR_NO. I really need
a place to start with this one so any help is appreciated!



That's pretty vague. Are these Text fields or are they
numeric type? Are these fields in the same table or
different tables?

Maybe you can adapt this kind of condition to your needs:

Right(HLP_CODE, 1) = Left(TR_NO, 1)

--
Marsh
MVP [MS Access]
  #3  
Old October 4th, 2006, 08:59 PM posted to microsoft.public.access.queries
TKM
external usenet poster
 
Posts: 289
Default Criteria from 2 fields to display one result

All are text fields. They are in two seprate tables in one query.

"Marshall Barton" wrote:

TKM wrote:

I need to retreive a Transaction Type (field named HLP_TEXT) based from the
following two fields.

1. TR_NO (has 4 digits such as 3112, 4009 or any other 4 digits combinations)
2. HLP_CODE (has 5 digits isuch as 30003, 40034 or any other 5 digit combos)

Notice that the last digit of the HLP_CODE is the first digit of the TR_NO?
This number represents a Transaction Type. I need to place this in my
criteria so I can find a Transaction Type for the given TR_NO. I really need
a place to start with this one so any help is appreciated!



That's pretty vague. Are these Text fields or are they
numeric type? Are these fields in the same table or
different tables?

Maybe you can adapt this kind of condition to your needs:

Right(HLP_CODE, 1) = Left(TR_NO, 1)

--
Marsh
MVP [MS Access]

  #4  
Old October 4th, 2006, 09:18 PM posted to microsoft.public.access.queries
TKM
external usenet poster
 
Posts: 289
Default Criteria from 2 fields to display one result

My results should be provide all the fields in my HLP_TEXT field that match
the following criteria. If the first number in TR_NO field matches the last
digit in the HLP_CODE field then show all those records. All the fields are
text from two seprate tables in one query. hope this helps?

"TKM" wrote:

All are text fields. They are in two seprate tables in one query.

"Marshall Barton" wrote:

TKM wrote:

I need to retreive a Transaction Type (field named HLP_TEXT) based from the
following two fields.

1. TR_NO (has 4 digits such as 3112, 4009 or any other 4 digits combinations)
2. HLP_CODE (has 5 digits isuch as 30003, 40034 or any other 5 digit combos)

Notice that the last digit of the HLP_CODE is the first digit of the TR_NO?
This number represents a Transaction Type. I need to place this in my
criteria so I can find a Transaction Type for the given TR_NO. I really need
a place to start with this one so any help is appreciated!



That's pretty vague. Are these Text fields or are they
numeric type? Are these fields in the same table or
different tables?

Maybe you can adapt this kind of condition to your needs:

Right(HLP_CODE, 1) = Left(TR_NO, 1)

--
Marsh
MVP [MS Access]

  #5  
Old October 5th, 2006, 07:11 AM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Criteria from 2 fields to display one result

If you need the entire query:

You really should be more specific. Are you matching every
record in this table to every record in that table? Or are
the records in this table linked to the records in that
table by the usual one-many PK-FK arrangement?

Since i can't do the latter without more information, I just
give an example of the former:

SELECT [this table].*, [that table].*
FROM [this table], [that table]
WHERE Right([this table].HLP_CODE, 1) = Left([that
table].TR_NO, 1)
--
Marsh
MVP [MS Access]


TKM wrote:

My results should be provide all the fields in my HLP_TEXT field that match
the following criteria. If the first number in TR_NO field matches the last
digit in the HLP_CODE field then show all those records. All the fields are
text from two seprate tables in one query. hope this helps?

"TKM" wrote:

All are text fields. They are in two seprate tables in one query.

"Marshall Barton" wrote:

TKM wrote:

I need to retreive a Transaction Type (field named HLP_TEXT) based from the
following two fields.

1. TR_NO (has 4 digits such as 3112, 4009 or any other 4 digits combinations)
2. HLP_CODE (has 5 digits isuch as 30003, 40034 or any other 5 digit combos)

Notice that the last digit of the HLP_CODE is the first digit of the TR_NO?
This number represents a Transaction Type. I need to place this in my
criteria so I can find a Transaction Type for the given TR_NO. I really need
a place to start with this one so any help is appreciated!


That's pretty vague. Are these Text fields or are they
numeric type? Are these fields in the same table or
different tables?

Maybe you can adapt this kind of condition to your needs:

Right(HLP_CODE, 1) = Left(TR_NO, 1)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.