Solved

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

Posted on 2010-08-25
3
436 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:whspider
  • 2
3 Comments
 
LVL 2

Expert Comment

by:gordontm
ID: 33520359
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

0
 

Author Comment

by:whspider
ID: 33520464
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
0
 
LVL 2

Accepted Solution

by:
gordontm earned 500 total points
ID: 33520501
OK. Try this instead

Replace this line

.CommandText = Array("select product...")

with

.CommandText = "select product..."

This worked for me when I tried it.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Preserve formatting during mail merge using VBA 18 42
Date Formatting on Userform Print 5 27
Adding Additional Criteria to a formula 17 47
Index Match Array? 5 38
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question