Link to home
Start Free TrialLog in
Avatar of whspider
whspider

asked on

How to Resolve the Type Mismatch Error in Sql Query using VBA Macros

Hi, I am populating a Data from  MDB using VBA Macros. I am Facing a problem with the SQL Statement ERROR : Type Mismatch. But If i run the same code in Access Sql View , Its working properly .
How to solve This problem i attach my file for your clarification please guide me.
Thanks In Advance
test.zip
Avatar of gordontm
gordontm

Hi!
If you remove the two columns product.SKU and NORTH_2010.vles from the SELECT (as per the code attached), then the Type Mismatch problem goes away, so I recommend you use this is a starting point to solve the problem.


.CommandText = Array("select product.ProductID from product,Depot,Zones,NORTH_2010 where NORTH_2010.PrductID=product.ProductID and NORTH_2010.Mnth='January' and NORTH_2010.Type='PRE' and Zones.ID=NORTH_2010.ZoneID and Depot.DeptId=NORTH_2010.DepotID order by Depot.DepotName")

Open in new window

Avatar of whspider

ASKER

Thanks for your Comment, But Those two fields are mandatory fields,my doubt is why it shows error for that two fields . Is there is any other way to solve this error without removing the fields name
ASKER CERTIFIED SOLUTION
Avatar of gordontm
gordontm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial