Can't Search data from table

B

billy_pit

Hi,
My project is in MS Access.
In that I have one Form(Search) which I am using for Search data in my
Table(PRODUCTION).
Now in this form I have one Combobox(PalletNo) and one button(Search)
When I select an item from combobox and click on Search button then it
will generate report based on search criteria.
In my combobox items are like
PFI
LPL
LPL/AVON
LPL/EL
LPL/PFI
VIC
ZERTH
etc
Now when I select anything except LPP/PFI
then it will shoe me result whatever I nedd.
But when I select LPL/PFI then it will show me error that Data Tyoe
Mismatch in Criteria Expression.
Only for perticular item it shows me Error.
Even I check Table also but there is no such problem in it also.
I think there is /P in LPL/PFI so may be because of that it will show
error.Or is there any other problem?
I am using this code on click event of Search Button

Private Sub Search1_Click()
On Error GoTo Err_Search1_Click

Dim stDocName As String

stDocName = "PRODUCTION1"
DoCmd.OpenReport stDocName, acViewPreview, , "PRODUCTION.CustomerCode
= '" & Me!CustomerCode_Combo1 & "'"

Exit_Search1_Click:
Exit Sub

Err_Search1_Click:
MsgBox Err.Description
Resume Exit_Search1_Click

End Sub

Plz Help Me.
Thanks.
 
D

Duane Hookom

Does any value you are having trouble with contain a single quote/apostrophe
in the value?
 
B

billy_pit

Ya its working for all others value in my table.Like

PFI
FFG
FGI
LPL
LPL/EL
LPL/AVON
LPL/BBW
LPL/BOOM
LPL/EAI
ZIRTH
VIC

Only its not working for perticular value LPL/PFI.
When I copied the whole project to Local drive(C:/) or to My Documents
and run it then its working properly.But when its on server at that
time this problem occur.I don't know what wierd problem is this?I
never faced such kind of problem uptil now.Give me the solution, if
its possible.
By the way Thanks for ur reply.
 
D

Duane Hookom

I asked "Does any value you are having trouble with contain a single
quote/apostrophe in the value?" and you replied "Ya" but the samples you
provided didn't display any single quotes. Any value with a single quote
would break your code. You may need to change your code to:

DoCmd.OpenReport stDocName, acViewPreview, , & _
"PRODUCTION.CustomerCode= """ & Me!CustomerCode_Combo1 & """"
 
B

billy_pit

Sorry its my mistake.

By the way I got the answer.
It was mistake made by operator, who entering data, add some wierd
value in one field.Even its my fault also bcz I frogot to put
Validation code for that field.
But now its working properly.

Thank You.
 

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

Top