Data type mismatch in Criteria Expression

proballin

Registered User.
Local time
Yesterday, 22:14
Joined
Feb 18, 2008
Messages
105
CurrentDb.Execute "DELETE MkFrmFunc_Table.Region, MkFrmFunc_Table.SubRegion, MkFrmFunc_Table.Segment, MkFrmFunc_Table.Sector, MkFrmFunc_Table.Product, MkFrmFunc_Table.Percentage, MkFrmFunc_Table.Volume, MkFrmFunc_Table.Ingredient FROM MkFrmFunc_Table WHERE ((MkFrmFunc_Table.Region = '" & Me.Region_Combo.Column(1) & "') And (MkFrmFunc_Table.SubRegion = '" & Me.SubRegion_Combo & "') And (MkFrmFunc_Table.Segment = '" & Me.Segment_Combo.Column(1) & "') And (MkFrmFunc_Table.Sector= '" & Me.Sector_Combo.Column(1) & "') AND (MkFrmFunc_Table.Product= '" & Me.Product_Combo & "') AND (MkFrmFunc_Table.Percentage= '" & Me.Percentage_Text1 & "')AND (MkFrmFunc_Table.Volume = '" & Me.Volume_Text1 & "')AND (MkFrmFunc_Table.Ingredient= '" & Me.Ingredient_Combo1 & "'))"

I get this error, specifically at the '" & Me.Volume_Text1 & "' part. It is a number and I tried to just put " & Me.Volume_Text & " but then it says Run time error 3075, saying there is an extra parentheses in query expression. Any clue?
 
Also Me.Volume_Text1 should be allowed to be NULL as well.
 
Well I found a work around to this issue by doing it a different way...but maybe someone may need help with a similar problem.
 
Code:
CurrentDb.Execute "DELETE MkFrmFunc_Table.Region, MkFrmFunc_Table.SubRegion, 
   MkFrmFunc_Table.Segment, MkFrmFunc_Table.Sector, MkFrmFunc_Table.Product, 
MkFrmFunc_Table.Percentage, MkFrmFunc_Table.Volume, MkFrmFunc_Table.Ingredient 

FROM MkFrmFunc_Table  

WHERE ((MkFrmFunc_Table.Region = '" & Me.Region_Combo.Column(1) & "') And 
   (MkFrmFunc_Table.SubRegion = '" & Me.SubRegion_Combo & "') And 
      (MkFrmFunc_Table.Segment = '" & Me.Segment_Combo.Column(1) & "') And 
         (MkFrmFunc_Table.Sector= '" & Me.Sector_Combo.Column(1) & "') AND
      (MkFrmFunc_Table.Product= '" & Me.Product_Combo & "') AND 
   (MkFrmFunc_Table.Percentage= '" & Me.Percentage_Text1 & "')AND 
(MkFrmFunc_Table.Volume = '" & Me.Volume_Text1 & "')AND 
   (MkFrmFunc_Table.Ingredient= '" & Me.Ingredient_Combo1 & "'))"
I get this error, specifically at the '" & Me.Volume_Text1 & "' part. It is a number and I tried to just put " & Me.Volume_Text & " but then it says Run time error 3075, saying there is an extra parentheses in query expression. Any clue?
You did the right thing I think with the change you made, but that will yield an extra quote mark after the end of the statement (logically):
Code:
[color=red][b]"[/color][/b] & Me.Volumne_Text1 & [color=red][b][u][size=4]"[/size][/u][/color][/b]
Thus, the program is reading the first quote mark as the end of the statement. Your extra parenthesis character would then be here:
Code:
(MkFrmFunc_Table.Percentage= " & Me.Percentage_Text1 & "[COLOR="Red"][B][size=4])[/size][/B][/COLOR]
Just an FYI I guess. I think I'm right, but can't give you a 100% "Okey Dokey" on it. ;)
 
Last edited:
Lol...that is exactly what I wrote above...the " & Me.Volumn_Text1 & " was in between the parethesis.
 

Users who are viewing this thread

Back
Top Bottom