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  

Query for 'confirmation'



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2005, 01:52 PM
rogge
external usenet poster
 
Posts: n/a
Default Query for 'confirmation'

Please help. I am trying to make updating a 'confirmation' routine quick and
easily updateable by some one else.

I have 2 tables, one of which I would like to use to confirm data.

tblTitle: tblState:
RecordID RecordID
Title ParentID
State State

Unfortunately, I cannot use a 'real' relationship to define 'tblTitle.State'
using 'tblState'. 'tblTitle' is imported from a text file.

What I would like to do, preferably using only SQL, is to program a field
similar to this expression (using pseudo code) 'St: IIf(tblTitle.State not
included in tblState.State; "«Unrecognized State»"; tblTitle.State)'

So other users can update 'tblState' as necessary to account for changes in
the exported text file, I wish to avoid:
nested IIf without using tblState
additinal VB code to loop through tblState


(A little background, this frontend does, hopefully, every thing but the
data collection for project tracking. Why on earth anyone would make a
'Nice' project tracking software with out reporting more than lists of
records is beyond my comprehension.)

thanks, Rogge
  #2  
Old April 14th, 2005, 09:01 PM
MGFoster
external usenet poster
 
Posts: n/a
Default

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table tblTitle is imported, then it IS an Access table and
relationships can be created between other tables. But, you really
don't need that. If I understand your problem statement correctly, you
want to substitute "«Unrecognized State»" for the state when the
tblTitle State is not in tblState. You could write a query like this:

SELECT T.State As Title_State, Nz(S.State,"«Unrecognized State»") As
State_State
FROM tblTitle As T LEFT JOIN tblState As S
ON T.State = S.State
WHERE S.State IS NULL

Since you need to know which state is missing from tblState the above
query shows only which states are missing. If you want to see all
states, including missing states, remove the WHERE clause.

The Nz() function returns the 2nd parameter when the 1st parameter is
null. The LEFT JOIN returns all rows from tblTitle and NULL rows from
tblState when there isn't a equivalent State in tblState. If the
tblState.State column is NULL the Nz() function will return
"«Unrecognized State»."
--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQl7L8YechKqOuFEgEQIsyACeLXYawn5cnF4hjk5VrH6ijf tXT9sAoJvE
HImLsgHGenZNqYm0hiw9kRL0
=66PA
-----END PGP SIGNATURE-----

rogge wrote:
Please help. I am trying to make updating a 'confirmation' routine quick and
easily updateable by some one else.

I have 2 tables, one of which I would like to use to confirm data.

tblTitle: tblState:
RecordID RecordID
Title ParentID
State State

Unfortunately, I cannot use a 'real' relationship to define 'tblTitle.State'
using 'tblState'. 'tblTitle' is imported from a text file.

What I would like to do, preferably using only SQL, is to program a field
similar to this expression (using pseudo code) 'St: IIf(tblTitle.State not
included in tblState.State; "«Unrecognized State»"; tblTitle.State)'

So other users can update 'tblState' as necessary to account for changes in
the exported text file, I wish to avoid:
nested IIf without using tblState
additinal VB code to loop through tblState


(A little background, this frontend does, hopefully, every thing but the
data collection for project tracking. Why on earth anyone would make a
'Nice' project tracking software with out reporting more than lists of
records is beyond my comprehension.)

thanks, Rogge

  #3  
Old April 15th, 2005, 09:17 AM
rogge
external usenet poster
 
Posts: n/a
Default

I do use Nz(); I find it very usefull

But my problem lies in a 'non-recognized' value not a null value.

Lets say 'tblTitle.State' has these values:

10. Initiation
20. In Progress
30. Waiting for Feedback
31. Waiting for Feedback - Check
40. Completed

and 'tblState.State' has, as these 'official options' for the 'State' field:

10. Initiation
20. In Progress
30. Waiting for Feedback
40. Completed

I would like "31. Waiting for Feedback - Check" to appear as "«Unrecognized
State» (touch the data again - I'll send Luca Brasi.)"

Well maybe I'll leave my personal comments out of the database.... LOL

Have a great weekend!
-r

"MGFoster" wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table tblTitle is imported, then it IS an Access table and
relationships can be created between other tables. But, you really
don't need that. If I understand your problem statement correctly, you
want to substitute "«Unrecognized State»" for the state when the
tblTitle State is not in tblState. You could write a query like this:

SELECT T.State As Title_State, Nz(S.State,"«Unrecognized State»") As
State_State
FROM tblTitle As T LEFT JOIN tblState As S
ON T.State = S.State
WHERE S.State IS NULL

Since you need to know which state is missing from tblState the above
query shows only which states are missing. If you want to see all
states, including missing states, remove the WHERE clause.

The Nz() function returns the 2nd parameter when the 1st parameter is
null. The LEFT JOIN returns all rows from tblTitle and NULL rows from
tblState when there isn't a equivalent State in tblState. If the
tblState.State column is NULL the Nz() function will return
"«Unrecognized State»."
--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQl7L8YechKqOuFEgEQIsyACeLXYawn5cnF4hjk5VrH6ijf tXT9sAoJvE
HImLsgHGenZNqYm0hiw9kRL0
=66PA
-----END PGP SIGNATURE-----

rogge wrote:
Please help. I am trying to make updating a 'confirmation' routine quick and
easily updateable by some one else.

I have 2 tables, one of which I would like to use to confirm data.

tblTitle: tblState:
RecordID RecordID
Title ParentID
State State

Unfortunately, I cannot use a 'real' relationship to define 'tblTitle.State'
using 'tblState'. 'tblTitle' is imported from a text file.

What I would like to do, preferably using only SQL, is to program a field
similar to this expression (using pseudo code) 'St: IIf(tblTitle.State not
included in tblState.State; "«Unrecognized State»"; tblTitle.State)'

So other users can update 'tblState' as necessary to account for changes in
the exported text file, I wish to avoid:
nested IIf without using tblState
additinal VB code to loop through tblState


(A little background, this frontend does, hopefully, every thing but the
data collection for project tracking. Why on earth anyone would make a
'Nice' project tracking software with out reporting more than lists of
records is beyond my comprehension.)

thanks, Rogge


  #4  
Old April 15th, 2005, 07:42 PM
MGFoster
external usenet poster
 
Posts: n/a
Default

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Run my query. You'll find that it does what you want. Read up on LEFT
JOIN in the Access Help articles on Microsoft Jet SQL Reference Data
Manipulation Language LEFT JOIN, RIGHT JOIN Operations.
--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmALLoechKqOuFEgEQKjpQCeMs1Xk/x90OzKocN/55EZiQFyP/UAnir/
cAEuhwANbWZ745LoAub0CZaD
=LOmm
-----END PGP SIGNATURE-----

rogge wrote:
I do use Nz(); I find it very usefull

But my problem lies in a 'non-recognized' value not a null value.

Lets say 'tblTitle.State' has these values:

10. Initiation
20. In Progress
30. Waiting for Feedback
31. Waiting for Feedback - Check
40. Completed

and 'tblState.State' has, as these 'official options' for the 'State' field:

10. Initiation
20. In Progress
30. Waiting for Feedback
40. Completed

I would like "31. Waiting for Feedback - Check" to appear as "«Unrecognized
State» (touch the data again - I'll send Luca Brasi.)"

Well maybe I'll leave my personal comments out of the database.... LOL

Have a great weekend!
-r

"MGFoster" wrote:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the table tblTitle is imported, then it IS an Access table and
relationships can be created between other tables. But, you really
don't need that. If I understand your problem statement correctly, you
want to substitute "«Unrecognized State»" for the state when the
tblTitle State is not in tblState. You could write a query like this:

SELECT T.State As Title_State, Nz(S.State,"«Unrecognized State»") As
State_State
FROM tblTitle As T LEFT JOIN tblState As S
ON T.State = S.State
WHERE S.State IS NULL

Since you need to know which state is missing from tblState the above
query shows only which states are missing. If you want to see all
states, including missing states, remove the WHERE clause.

The Nz() function returns the 2nd parameter when the 1st parameter is
null. The LEFT JOIN returns all rows from tblTitle and NULL rows from
tblState when there isn't a equivalent State in tblState. If the
tblState.State column is NULL the Nz() function will return
"«Unrecognized State»."
--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQl7L8YechKqOuFEgEQIsyACeLXYawn5cnF4hjk5VrH6ijf tXT9sAoJvE
HImLsgHGenZNqYm0hiw9kRL0
=66PA
-----END PGP SIGNATURE-----

rogge wrote:

Please help. I am trying to make updating a 'confirmation' routine quick and
easily updateable by some one else.

I have 2 tables, one of which I would like to use to confirm data.

tblTitle: tblState:
RecordID RecordID
Title ParentID
State State

Unfortunately, I cannot use a 'real' relationship to define 'tblTitle.State'
using 'tblState'. 'tblTitle' is imported from a text file.

What I would like to do, preferably using only SQL, is to program a field
similar to this expression (using pseudo code) 'St: IIf(tblTitle.State not
included in tblState.State; "«Unrecognized State»"; tblTitle.State)'

So other users can update 'tblState' as necessary to account for changes in
the exported text file, I wish to avoid:
nested IIf without using tblState
additinal VB code to loop through tblState


(A little background, this frontend does, hopefully, every thing but the
data collection for project tracking. Why on earth anyone would make a
'Nice' project tracking software with out reporting more than lists of
records is beyond my comprehension.)

thanks, Rogge


  #5  
Old April 16th, 2005, 06:44 AM
MGFoster
external usenet poster
 
Posts: n/a
Default

MGFoster wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Run my query. You'll find that it does what you want. Read up on LEFT
JOIN in the Access Help articles on Microsoft Jet SQL Reference Data
Manipulation Language LEFT JOIN, RIGHT JOIN Operations.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On further thought you could run a query like the following. It finds
all States in tblTitle that are not in tblState. Same thing I had
before just w/o the Nz() function.:

SELECT T.State As Title_State, "«Unrecognized State»" As State_State
FROM tblTitle As T LEFT JOIN tblState As S
ON T.State = S.State
WHERE S.State IS NULL

--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmCmMoechKqOuFEgEQLXdgCfTgCzi506w70m/r/fxgmc7OclDB0AnjGZ
lXY8gjObMp07a3gsiEr+Mmzu
=nwV8
-----END PGP SIGNATURE-----
  #6  
Old April 18th, 2005, 08:13 AM
rogge
external usenet poster
 
Posts: n/a
Default

The entire record needs to be returned where unrecognized values are shown as
«Unrecognized State» with out replacing the data.

for instance this is the data in the table

Title: State
check oil 10. initiation
replace oil filter 30. Waiting for Feedback
replace oil 31. Waiting for Feedback - Check

what i want to return is...
Title: State
check oil 10. initiation
replace oil filter 30. Waiting for Feedback
replace oil «Unrecognized State»

Thank you for your time and effort.


"MGFoster" wrote:

MGFoster wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Run my query. You'll find that it does what you want. Read up on LEFT
JOIN in the Access Help articles on Microsoft Jet SQL Reference Data
Manipulation Language LEFT JOIN, RIGHT JOIN Operations.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On further thought you could run a query like the following. It finds
all States in tblTitle that are not in tblState. Same thing I had
before just w/o the Nz() function.:

SELECT T.State As Title_State, "«Unrecognized State»" As State_State
FROM tblTitle As T LEFT JOIN tblState As S
ON T.State = S.State
WHERE S.State IS NULL

--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmCmMoechKqOuFEgEQLXdgCfTgCzi506w70m/r/fxgmc7OclDB0AnjGZ
lXY8gjObMp07a3gsiEr+Mmzu
=nwV8
-----END PGP SIGNATURE-----

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested in-line Query laura Running & Setting Up Queries 0 February 11th, 2005 12:17 AM
AVG Function in a Query JohnL Running & Setting Up Queries 5 December 18th, 2004 05:52 AM
Return repeats info in "8s" Joy Rose Running & Setting Up Queries 14 October 13th, 2004 10:07 PM
Big number gives error! Sara Mellen Running & Setting Up Queries 8 October 11th, 2004 02:48 AM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM


All times are GMT +1. The time now is 11:21 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.