Type Mismatch

DorisL

Registered User.
Local time
Today, 08:03
Joined
Jul 23, 2001
Messages
14
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?
 
[IID] and [TID] in table tblTaskMemo are also Text data types?



[This message has been edited by pdx_man (edited 12-11-2001).]
 
Yes
 
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.
 
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?
 
Your quotes are in the wrong place:

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

Users who are viewing this thread

Back
Top Bottom