Data Mismatch

AnnaFoot

Registered User.
Local time
Today, 23:23
Joined
Dec 5, 2000
Messages
51
Hello,

I have a fairly complicated query that pulls information from various tables to populate a report.

Basically, i want a letter sent to all people who meet a certain set of criteria. I have a calculated field in the query:

Let: DLookUp("[letter]","diagnosis","[type] ='" & [d1] & "'")*IIf(IsNull(DLookUp("[letter]","diagnosis","[type] ='" & [d2] & "'")),1,DLookUp("[letter]","diagnosis","[type] ='" & [d2] & "'"))

Where d1 and d2 are fields already in the query.

This Let field returns a 0, if no letter should be printed and either a 1 or a -1 if it should.

This works perfectly. What i initially wanted to do was to set the criteria for this field <>0, but then it prompts me for d1 and d2. I discovered a way round this by setting [let] <> 0, as the wherecondition, when i call the report.

This worked perfectly until last week. Now a message "data type mismatch in criteria" comes up and the report won't generate.

I've tried all sorts of things, and the only way to overcome it that i have found so far is to remove the wherecondition as i call the report. This, of course, causes all the records to print, regardless of the value of [let].

What is odd is that this was working - and still is on my old version of the backend, but not with the current version, using exactly the same front end!

Any one have any ideas?

I can produce another report that lists all the people who should get letters, so once the whole lot has printed they can manually pull the ones that shouldn't be sent - not the sweetest solution!

Anna
 
Sounds like your return type is not the same as your criteria. Have you tried CINT(all your dlookup stuff here) to see if that will fix your issue? Would force your return type to be an intiger then? Just guessing, but might be worth a try.
 
Thanks FOFA,
I tried that - but still no good. I understand that it doesn't seem to think that the value is an integer. Is there a way to set the data type of a calculated value? I've tried in the properties, but it only give me the option of format. I've tried to format it as text even, and then used the ' in the wherecondition, but that's no good either.

Oh well, it may have to stay a manual exercise.

Anna
 
To replace a sensitive data:
 

Attachments

  • untitled1.jpg
    untitled1.jpg
    29.3 KB · Views: 170

Users who are viewing this thread

Back
Top Bottom