Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 5th, 2004, 12:15 AM
Authorized User
Join Date: Apr 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Type mismatch error

Can someone tell me what is wrong with this line:

SQL = "update tblGroupAndMembers set group_id = '" & !group_id & "' where member_id = '" & memberId & "'"

I keep getting 'Data type mismatch in criteria expression.' If i hard code memberId then I dont get the error. I dont understand what I am doing wrong. i defined memberID as Integer. The data Type for member_id in the tblGroupAndMembers table is number with field size integer. Can someone please help?

This line is in the following code:

With rstMemberId
     SQL = "insert into tblGroupAndMembers(member_id) values('" & !member_id & "')"
     db.Execute SQL
     memberId = !member_id
End With

      Set qdfTemp = db.CreateQueryDef("", _
        "SELECT group_id FROM tblGroupNames WHERE group_name = '" & cmbGroupName & "' ")
    Set rstGroupId = qdfTemp.OpenRecordset()
    With rstGroupId
    SQL = "update tblGroupAndMembers set group_id = '" & !group_id & "' where member_id = '" & memberId & "'"
     db.Execute SQL
End With


Reply With Quote
  #2 (permalink)  
Old May 5th, 2004, 09:16 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

If Member ID is an integer, then

SQL = "update tblGroupAndMembers set group_id = '" & !group_id & "' where member_id = " & memberId

Don't surround it with single quotes.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data type mismatch sharon5469 ASP.NET 1.0 and 1.1 Basics 2 May 27th, 2007 10:01 AM
error 3464 'data type mismatch in criteria express Vince_421 Access VBA 3 May 3rd, 2007 06:45 AM
Data Type Mismatch Error in Criteria Expression mmcdonal Access VBA 2 March 1st, 2007 05:18 PM
data type mismatch karma SQL Language 3 April 6th, 2006 07:58 AM
Data Type Mismatch error transcona Classic ASP Databases 4 June 25th, 2003 07:23 PM

All times are GMT -4. The time now is 05:12 AM.

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