dbTalk Databases Forums  

Criteria in query

comp.databases.ms-access comp.databases.ms-access


Discuss Criteria in query in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David B
 
Posts: n/a

Default Criteria in query - 01-09-2012 , 01:57 PM






Background -
I have app for managing cattle (UK)

If a calf is an Embryo transfer then [Dam ID] and [surrdamID] will be
different.
If the calf is natural then the 2 field will contain the same number (
Historic Issue involving 10 years ao data!)

A query sorts out data which is used to generate an email to send new calf
details to the gov database.

Up to now I have been registering ET calves manually but I am trying to
tweak things to solve this.

The simple answer would be to get the query to do this > If dam ID =
SurrdamID then surrdamID is Null

Can not figure out how to sort this

TIA
David

Reply With Quote
  #2  
Old   
Douglas J Steele
 
Posts: n/a

Default Re: Criteria in query - 01-09-2012 , 03:52 PM






Do you want to do this permanently, or just for a form or report?

If permanently, use an Update query:

UPDATE MyTable
SET surrdamID = Null
WHERE [Dam ID] = surrdamID

If just for a form or report, use a query that has the a calculated field
along the lines of

IIf([Dam ID] = [surrdamID], Null, [surrdamID])


"David B" wrote in message news:LNadnd_Ge98x25bSnZ2dnUVZ8gOdnZ2d (AT) bt (DOT) com...

Background -
I have app for managing cattle (UK)

If a calf is an Embryo transfer then [Dam ID] and [surrdamID] will be
different.
If the calf is natural then the 2 field will contain the same number (
Historic Issue involving 10 years ao data!)

A query sorts out data which is used to generate an email to send new calf
details to the gov database.

Up to now I have been registering ET calves manually but I am trying to
tweak things to solve this.

The simple answer would be to get the query to do this > If dam ID =
SurrdamID then surrdamID is Null

Can not figure out how to sort this

TIA
David

Reply With Quote
  #3  
Old   
David B
 
Posts: n/a

Default Re: Criteria in query - 01-10-2012 , 03:00 AM



Spot on. Many thanks

DB

"Douglas J Steele" <NOSPAM_djsteele (AT) NOSPAM_gmail (DOT) com> wrote

Quote:
Do you want to do this permanently, or just for a form or report?

If permanently, use an Update query:

UPDATE MyTable
SET surrdamID = Null
WHERE [Dam ID] = surrdamID

If just for a form or report, use a query that has the a calculated field
along the lines of

IIf([Dam ID] = [surrdamID], Null, [surrdamID])


"David B" wrote in message
news:LNadnd_Ge98x25bSnZ2dnUVZ8gOdnZ2d (AT) bt (DOT) com...

Background -
I have app for managing cattle (UK)

If a calf is an Embryo transfer then [Dam ID] and [surrdamID] will be
different.
If the calf is natural then the 2 field will contain the same number (
Historic Issue involving 10 years ao data!)

A query sorts out data which is used to generate an email to send new calf
details to the gov database.

Up to now I have been registering ET calves manually but I am trying to
tweak things to solve this.

The simple answer would be to get the query to do this > If dam ID =
SurrdamID then surrdamID is Null

Can not figure out how to sort this

TIA
David

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.