Help with MS Access (1 Viewer)

chetan.bhalla

New member
Local time
Today, 15:30
Joined
Feb 12, 2009
Messages
3
Hello Everyone,

I need help with MS Access.I have got 2 fields populated A and B.I need to achieve is that field B has things with LOGICAL, PHYSICAL AND BLANK Boxes listed. I need to ensure that anything which is logical in Field B the corresponding value in A will be something like if there is LOGICAL in B it should make the field A blank and if it is anything else apart from LOGICAL it should be left as it is.

Will appreciate any help on this. I guess will have to use the IF statement.

Regards,
Chetan
 

MSAccessRookie

AWF VIP
Local time
Today, 06:00
Joined
May 2, 2008
Messages
3,428
Hello Everyone,

I need help with MS Access.I have got 2 fields populated A and B.I need to achieve is that field B has things with LOGICAL, PHYSICAL AND BLANK Boxes listed. I need to ensure that anything which is logical in Field B the corresponding value in A will be something like if there is LOGICAL in B it should make the field A blank and if it is anything else apart from LOGICAL it should be left as it is.

Will appreciate any help on this. I guess will have to use the IF statement.

Regards,
Chetan

I will attempt to rephrase what you said, and then provide an answer based on my understanding.

You want to possibly set the Value of Field A based on the Contents of Field B, based on the following conditions:
  • If FieldB Contains the phrase "LOGICAL", then the value in Field A needs to be set to cleared (Set to "")
  • If FieldB Does not contain the phrase "LOGICAL", then the value in Field A needs to be left alone.
An IIF Statement could handle this.
Code:
YourTable.FieldA = IIf(YourTable.FieldB="LOGICAL", "", YourTable.FieldA)

Post back if you have any questions.
 

chetan.bhalla

New member
Local time
Today, 15:30
Joined
Feb 12, 2009
Messages
3
Rookies,

Thank you for replying back but the problem is that the Field A has some numerical data and Field B has Character data in it and this not returning the desired value.Any suggestions...

Regards,
Chetan.
 

MSAccessRookie

AWF VIP
Local time
Today, 06:00
Joined
May 2, 2008
Messages
3,428
Rookies,

Thank you for replying back but the problem is that the Field A has some numerical data and Field B has Character data in it and this not returning the desired value.Any suggestions...

Regards,
Chetan.

If the Type of FieldA is Numeric and the Type of FieldB is Text, then the code would be as follows:

Code:
YourTable.FieldA = IIf(YourTable.FieldB="LOGICAL", [B][COLOR=red]Null[/COLOR][/B], YourTable.FieldA)
 

jenny_adams

New member
Local time
Today, 03:00
Joined
Mar 2, 2009
Messages
3
Thanks for all the help guys, I've found this threat quite useful x
 

Users who are viewing this thread

Top Bottom