Conernesto
asked on
Access query expression
I have a table with a field called "ST". In the field ST there are records with two digits or more. I need an expression that will get records that only have two digits. I also need an expression that will give the record if the record has more than two digits. See sample below of what I have and what I want. Can you provide an expression that will do this? Thank you.
Have Want Expression1 Want Expression2
NY NY
OHCOL OHCOL
Have Want Expression1 Want Expression2
NY NY
OHCOL OHCOL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then try my first suggestion. I asked the question only because the request didn't make sense to me.
ASKER
Are you able to send me the above in non SQL format?
Not if you want it in a query. Just create a new query and switch to SQL view. copy and paste my query and then change the column and table names to match your database.
If you want the expression to be the ControlSource for an unbound control, then ithey would look like:
ControlA ControlSource
=IIf(Len([ST]) = 2, [ST], Null)
ControlB ControlSource
=IIf(Len([ST] <> 2, [ST], Null)
The ControlSource property is on the Data tab of the control's properties dialog. Put the expression including the leading "=" into the property named ControlSource.
If you want the expression to be the ControlSource for an unbound control, then ithey would look like:
ControlA ControlSource
=IIf(Len([ST]) = 2, [ST], Null)
ControlB ControlSource
=IIf(Len([ST] <> 2, [ST], Null)
The ControlSource property is on the Data tab of the control's properties dialog. Put the expression including the leading "=" into the property named ControlSource.
ASKER
Thank you.
ASKER