473,387 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem in inserting a row to MS-Access Table

Hi Everyone,

I am trying to insert a row into MS-Access table. The table contains the details of error (number and description) occured in the whole script. The query written for inserting a row is as follows.

strQuery = "Insert into ErrorLog values('& Err.Number & ",' " & Err.Description & " ')"

The problem is the Error description is like "The directory doesn't exists", in which a single quote is present (doesn't). Because of that the row is not getting inserted.

So can u please suggest mw how to overcome this issue.

Thanks in Advance
Regards
Priya ramanan
Dec 17 '07 #1
5 1533
QVeen72
1,445 Expert 1GB
Hi ,

Try to use Replace Function :
Something like this :

strQuery = "Insert into ErrorLog values(" & Err.Number & ",' " & Replace(Err.Description, "'", "") & " ')"

Regards
Veena
Dec 17 '07 #2
Thanks Veena. Its working fine.

But to know more about the problem, i am asking you this.
Is there any other solution to solve this issue.

If so just let me know.

Thanks Again

regards
Priya ramanan
Dec 17 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

You can Open a Dynamic RecordSet and add, using "AddNew" method, Instead of using an "Insert" Statment.

Also, you can use Escape Characters..

REgards
Veena
Dec 17 '07 #4
Killer42
8,435 Expert 8TB
There's also an article in the Access "HowTo's" on TheScripts which discusses the various issues around single and double quotes.
Dec 17 '07 #5
Torgg
41
I found this article to be very helpful in overcoming issues like this.

Always Use Parameters, even if you don't use Stored Procedures

Hope this was helpful,
Torgg
Dec 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Alban Hertroys | last post by:
Hello, I'm using psycopg to insert records in a number of threads. After the threads finish, another thread runs to collect the inserted data. Now, my problem is that psycopg let's my threads...
1
by: Walt | last post by:
We are using ASP.net to develop a new website. The old website uses legacy ASP connecting to an Oracle database (9.2, W2k3, charecter set WE8ISO8859P1). The new site connects to the same database...
3
by: Herryandi | last post by:
Hi all, Im having date format in my ms sql server 2000 database. I always get a problem in inserting or updating data because of my date format. Im taking the value of date from textbox. This...
4
by: Kivanc Toker | last post by:
Hi, I've got a problem with displaying texts with turkish characters. There is a website administration system, which is developed using ASP (VBScript) and ADO. This system is being used for...
1
by: giniapatel | last post by:
hello all, i m using forms 6i with oracle 10g. i have set Nls_lang =American_America.UTF8. Now my problem is when i type some data i marathi Using a font converter engine directly into the text...
2
by: Krishna | last post by:
Hi, I have developed a for dataentry by using datagird in C# windows application, I am using combocolumns, textbox columns for the same, two readonly textboxcolumns for those readonly columns i...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
3
by: laststubborn | last post by:
Dear Memebers, I have a critical problem. I have an application is running on 64 bit machine. It used to be running on 32 bit machine. That application is using a Stored Procedure that uses...
6
by: dtarczynski | last post by:
Hello. I have problem when i inserting strings with special characters into MS SQL 2005 database for example:...
2
by: =?Utf-8?B?SiBTdHJlZ2Vy?= | last post by:
I have 2 methods activated through a context menu that insert and delete rows from the dataTable linked to a datagrid. I can delete rows the selected row with no problems, but when I try to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.