davewhiting
Programmer
I have been given the task of creating queries on a database where the data entry forms return an index number into a Text field, which should be joined to a reference table which uses a number field for the index. I know the simplest (and best) solution is to have the administrators change the field to in the data table to a number field but they refuse and will not budge on their decision. As a workaround, I have created a query that takes the data from the data table and converts the reference fields using:
CLng(IIf(IsNull([FieldName]) Or [FieldName]="",0,[FieldName]))
This works fine for if the field itself is Null or is a zero length text (as it appears to have both), however (As I have pointed out as the reason why it shouldn't be a text field) there is some data that has been transferred into the table with the values instead of the index number, meaning there is text which cannot be converted. Is there an easy way to test for this as I currently cannot join to this query as it has at least one record with an error?
CLng(IIf(IsNull([FieldName]) Or [FieldName]="",0,[FieldName]))
This works fine for if the field itself is Null or is a zero length text (as it appears to have both), however (As I have pointed out as the reason why it shouldn't be a text field) there is some data that has been transferred into the table with the values instead of the index number, meaning there is text which cannot be converted. Is there an easy way to test for this as I currently cannot join to this query as it has at least one record with an error?