Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 June 8th, 2003, 03:22 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inserting data into an Access memo field with SQL

Does anyone know if there is a special syntax needed in SQL for putting data into an access memo field via an SQL statement?

this is what i am doing...

dbValues="#" & savDate & "#" & ",'" & savTitle & "','" & savHide & "','" & savMemo & "'"

queryString="INSERT INTO myfile (kk_Date,kk_Title,kk_Hide,kk_Memo) values (" & dbValues & ")"

getting this error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

Help please!
 
Old June 8th, 2003, 10:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Nothing special is required. I would suspect that the contents of savMemo has an apostrophe in it somewhere. Look at the value of queryString and see if the SQL statement looks right.

Also make sure your datatypes in access are what you expect. Are you sure kk_date is a date/time? I'd check them all.

Hal Levy
Daddyshome, LLC
 
Old September 20th, 2005, 01:52 PM
Registered User
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to HexKrak Send a message via AIM to HexKrak Send a message via MSN to HexKrak Send a message via Yahoo to HexKrak
Default

This is my question too. And yes there is apostrophies in the data I need to insert, because I'm inserting a blob of html code into this field. I dont have the ability to change these characters then recode the data on the other side because I'm inserting the data into a database that another program utilizes(more or less writing an addon for the program). How can I work around getting the apostrophies into the field? Do I need to use another method of inserting? And if so where should I start lookin?

 
Old September 20th, 2005, 02:49 PM
Registered User
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to HexKrak Send a message via AIM to HexKrak Send a message via MSN to HexKrak Send a message via Yahoo to HexKrak
Default

ok never mind, I figured it out. Since I'd already edited all the quotes out and replaced them with apostrophies, all I had to do was

VALUES(" & Chr(34) & newdesc & Chr(34) & ")

as chr(34) puts the quotes in the sql statement at runtime. If I needed to put quotes in my blob of html I'd still be pretty skrewed, but for now this works fine.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract data from memo field knix2007 Access VBA 7 December 17th, 2007 03:24 PM
Inserting text from datagrid into Memo field in c# kgriffin Classic ASP Databases 0 May 4th, 2005 10:17 AM
sql error: memo field "LIKE" or "=" gilgalbiblewheel Classic ASP Databases 3 April 29th, 2005 07:16 AM
Problem with memo field in Access 97 Ardeshir Access 4 December 27th, 2004 06:05 AM
Access update memo field problem mar0364 Access ASP 0 March 25th, 2004 04:03 PM





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