Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2008, 07:14 AM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default hi i got runtime error 13 Type Mismatch error

 here is the code for connecting Microsoft access database to vb6 and an error is occured in the line Set reccnc = dbTata.OpenRecordset( "Select * from cnc where WONO like '" &a.Text&"' and ItemName like '"&b.Text"'")
in this dbTata is the name given to acess database and cnc is the table in it and WONO and ItemName's are primary keys and through this code im trying to retrieve data that matches with both the textboxes. hope u can understand my problem. waiting for ur reply. neways thank u in advance.

 
Old February 17th, 2008, 11:54 PM
Friend of Wrox
 
Join Date: Oct 2007
Location: , , .
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

apply proper spacing between words

"Select * from cnc where WONO like '" & a.Text &"' and ItemName like '"& b.Text & "'"



urt

Help yourself by helping someone.
 
Old February 21st, 2008, 09:30 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Urt is right about the spacing. Also, if you're going to use the LIKE function, then your strings need wildcards. Try something like:

Set reccnc = dbTata.OpenRecordset("SELECT DISTINCT * FROM cnc WHERE wono LIKE '*" & a.Text & "*' AND ItemName LIKE '*" & b.Text & "*'")


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division




Similar Threads
Thread Thread Starter Forum Replies Last Post
getting runtime error 13: type mismatch rita9 Beginning VB 6 2 March 14th, 2008 04:36 AM
runtime error '13' type mismatch denkidude Visual Basic 2005 Basics 5 March 15th, 2007 10:28 PM
Why am I getting Runtime Error 13: Type Mismatch? dan_thorman Excel VBA 1 January 24th, 2007 02:06 PM
Runtime Error 13: Type Mismatch in VB6 migzheart Access VBA 1 December 28th, 2005 07:54 AM
Error 13 Type Mismatch lguzman Access VBA 2 January 6th, 2005 10:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.