data type mismatch error

P

Praveen Manne

Hi,

I have two tables ..
1.tblPhys (fields are SSN, Sal)
2.tblTransTemp (fields are SSN, Sum,....)

the SSN field type is Text (not number)

I designed a form(frmTransA) which is connected to the tblTransTemp.
I have a combo box on the form frmTransA, thru which I can select the SSN
from the tblPhys
I have a text box, named Sal

When I select the SSN the Sal text box should populate the corresponding
value of that SSN .
This is the statement I Wrote for the After Update event of SSN Combo :
Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

But When I select the SSN .." Data Type MisMatch in Criteria Expression "
error is popping up . Do any one of you know how can I get rid of this
error?

Please Help

Thanks
Praveen
 
S

Steve Conway

Hi Praveen,

Change this line:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

To:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]='" & Forms!frmTransA!SSN & "'")

that's [SSN]=single quote double quote
and after the & it's double quote single quote double quote

HTH
Steve C
 
P

Praveen Manne

Hi Steve,

Thank you very much for your reply.. That worked

Praveen

Steve Conway said:
Hi Praveen,

Change this line:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

To:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]='" & Forms!frmTransA!SSN & "'")

that's [SSN]=single quote double quote
and after the & it's double quote single quote double quote

HTH
Steve C

Praveen Manne said:
Hi,

I have two tables ..
1.tblPhys (fields are SSN, Sal)
2.tblTransTemp (fields are SSN, Sum,....)

the SSN field type is Text (not number)

I designed a form(frmTransA) which is connected to the tblTransTemp.
I have a combo box on the form frmTransA, thru which I can select the SSN
from the tblPhys
I have a text box, named Sal

When I select the SSN the Sal text box should populate the corresponding
value of that SSN .
This is the statement I Wrote for the After Update event of SSN Combo :
Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

But When I select the SSN .." Data Type MisMatch in Criteria Expression "
error is popping up . Do any one of you know how can I get rid of this
error?

Please Help

Thanks
Praveen
 
S

Steve Conway

Glad to help

Steve C

Praveen Manne said:
Hi Steve,

Thank you very much for your reply.. That worked

Praveen

Steve Conway said:
Hi Praveen,

Change this line:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

To:

Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]='" & Forms!frmTransA!SSN & "'")

that's [SSN]=single quote double quote
and after the & it's double quote single quote double quote

HTH
Steve C

Praveen Manne said:
Hi,

I have two tables ..
1.tblPhys (fields are SSN, Sal)
2.tblTransTemp (fields are SSN, Sum,....)

the SSN field type is Text (not number)

I designed a form(frmTransA) which is connected to the tblTransTemp.
I have a combo box on the form frmTransA, thru which I can select the SSN
from the tblPhys
I have a text box, named Sal

When I select the SSN the Sal text box should populate the corresponding
value of that SSN .
This is the statement I Wrote for the After Update event of SSN Combo :
Me!Sal = DLookup("[Sal]", "tblPhys", "[SSN]=" & Forms!frmTransA!SSN)

But When I select the SSN .." Data Type MisMatch in Criteria
Expression
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top