View Full Version : Type Mismatch


DorisL
12-10-2001, 03:44 PM
On the On Open Event of a form I have this code:
Me![TID2] = DLookup("[TID]", "tblTaskMemo", "[IID]='" & Forms![frmInvoiceEdit]![IID] & "'" And _
"[TID]='" & Forms![frmInvoiceEdit]![TID] & "'")


[TID2] is an unbound text box and all the fields in the DLookup are text. I am getting a type mismatch error. Can anyone tell me what I'm doing wrong?

pdx_man
12-11-2001, 11:54 AM
and [TID] in table tblTaskMemo are also [i]Text data types?



[This message has been edited by pdx_man (edited 12-11-2001).]

DorisL
12-11-2001, 01:20 PM
Yes

Jack Cowley
12-11-2001, 01:40 PM
Just for fun have you tried your code in the On Current event of the form or put it as the Control Source of an unbound text box? The code looks good so it 'should' work and if you try it as the Control Source of an unbound text box it may give you a clue as to what is going on.

DorisL
12-11-2001, 04:59 PM
OK,I put it on the control source. The formula worked but it's returning the wrong value. I'm going to have to try something different. This was a work-around anyway.

I have a form based on two tables, both of which have the [IID] & [TID] as primary keys. Everything is fine until the user tries to edit the [TID]. The corresponding field in the second table is blanked out and Access won't let a new value to be entered. This is driving me crazy! Any ideas?

Pat Hartman
12-11-2001, 06:41 PM
Your quotes are in the wrong place:

Me![TID2] = DLookup("[TID]", "tblTaskMemo", "[IID]='" & Forms![frmInvoiceEdit]![IID] & "' And [TID]='" & Forms![frmInvoiceEdit]![TID] & "'")