By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,042 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,042 IT Pros & Developers. It's quick & easy.

Ways to deal with an occasional "txt string" in an otherwise "number" column

P: 11
Not so much a problem as a discussion. I am currently in the early stages of designing a database to hold a bunch of water quality data (e.g., concentrations of heavy metals in drinking water). Water samples will be sent to a lab for analysis and the lab will send back a report (usually in excel or .txt format), that data will be imported into Access. If the concentration of a heavy metal is lower than the detectable limit of the analysis, the report does not return a “0” but a txt string (say “<0.01”). In my database I want the column to be a number, so I can run a query that return a range (e.g., “Between 0.05 And 0.6). I obviously can’t store the txt string in a numbers column and I don’t want to assign an extremely small dummy number (say 0.0000000001) as a place holder, because it messes up any “min”, “sum”, or “avg” formulas.

The only option I can think of, doubling the size of the table by having two columns for every heavy metal (one txt and one number). In the records were there are a txt string (<0.01), leave it as null in the number column. Then all my queries will have to be setup so that they search for the “<” symbol before running (and include or exclude these values depending on the type of query).

Any questions, suggestions, comments would be greatly appreciated.

Thanks.

DuckNut
Mar 22 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,675
Not so much a problem as a discussion. I am currently in the early stages of designing a database to hold a bunch of water quality data (e.g., concentrations of heavy metals in drinking water). Water samples will be sent to a lab for analysis and the lab will send back a report (usually in excel or .txt format), that data will be imported into Access. If the concentration of a heavy metal is lower than the detectable limit of the analysis, the report does not return a “0” but a txt string (say “<0.01”). In my database I want the column to be a number, so I can run a query that return a range (e.g., “Between 0.05 And 0.6). I obviously can’t store the txt string in a numbers column and I don’t want to assign an extremely small dummy number (say 0.0000000001) as a place holder, because it messes up any “min”, “sum”, or “avg” formulas.

The only option I can think of, doubling the size of the table by having two columns for every heavy metal (one txt and one number). In the records were there are a txt string (<0.01), leave it as null in the number column. Then all my queries will have to be setup so that they search for the “<” symbol before running (and include or exclude these values depending on the type of query).

Any questions, suggestions, comments would be greatly appreciated.

Thanks.

DuckNut
Assuming the [Concentration] Field is a Single Precision Data Type and is contained within a Query, create a Calculated Field within the Query. This Field will return a String if the Concentration is lower than the Detectable Limit and the actual Concentration itself if it isn't. This Calculated Field could then be used as a Control Source for a Field on your Report. The Calculated Field would look something like:
Expand|Select|Wrap|Line Numbers
  1. Return: IIf([Concentration]<0.01,"<0.01",[Concentration])
Output:
Expand|Select|Wrap|Line Numbers
  1. Concentration    Return
  2. 0.01             0.01
  3. 0.005             <0.01
  4. 0.05              0.05
  5. 0.0023             <0.01
Mar 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.