473,396 Members | 2,004 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,396 software developers and data experts.

Cannot find answer to what seems simple error problem for insertinginto table

I posted a question before (to too many groups) and this time I am
sending to this group only. I have a quick script as seen below, the
file_list table has a unique field called file_name.

The problem I am having is that if no unique items exist, this will
insert into the table fine. But if a unique item does exist it will not
insert as it should. My problem is that I can not get access to return
any kind of error. This is very frustrating as I have scowered the net
for what is a seemingly easy thing to do.

What am I doing wrong here? Is there a better way to do this? My real
program is a fairly big sql insert script repeated many times and it is
failing for one reason or another. But I cannot find out why because I
cannot print the errors that are returned.
db = CurrentDb()
CurrentDb.Execute "insert into file_list (file_name) VALUES (test.txt)"
MsgBox ("good")
Debug.Print Err.Description
Debug.Print Err.Number

Nov 12 '05 #1
4 2084
frank wrote:
I posted a question before (to too many groups) and this time I am
sending to this group only. I have a quick script as seen below, the
file_list table has a unique field called file_name.

The problem I am having is that if no unique items exist, this will
insert into the table fine. But if a unique item does exist it will not
insert as it should. My problem is that I can not get access to return
any kind of error. This is very frustrating as I have scowered the net
for what is a seemingly easy thing to do.

What am I doing wrong here? Is there a better way to do this? My real
program is a fairly big sql insert script repeated many times and it is
failing for one reason or another. But I cannot find out why because I
cannot print the errors that are returned.
db = CurrentDb()
CurrentDb.Execute "insert into file_list (file_name) VALUES (test.txt)"
MsgBox ("good")
Debug.Print Err.Description
Debug.Print Err.Number


Add quotes around Test.Txt
CurrentDb.Execute "insert into file_list (file_name) VALUES ('test.txt')"

Nov 12 '05 #2
Problem is though, I cannot get access to print the error. I want to see
the errors I cannot get access to report them? Why?

Salad wrote:
frank wrote:
I posted a question before (to too many groups) and this time I am
sending to this group only. I have a quick script as seen below, the
file_list table has a unique field called file_name.

The problem I am having is that if no unique items exist, this will
insert into the table fine. But if a unique item does exist it will
not insert as it should. My problem is that I can not get access to
return any kind of error. This is very frustrating as I have scowered
the net for what is a seemingly easy thing to do.

What am I doing wrong here? Is there a better way to do this? My real
program is a fairly big sql insert script repeated many times and it
is failing for one reason or another. But I cannot find out why
because I cannot print the errors that are returned.
db = CurrentDb()
CurrentDb.Execute "insert into file_list (file_name) VALUES
(test.txt)"
MsgBox ("good")
Debug.Print Err.Description
Debug.Print Err.Number


Add quotes around Test.Txt
CurrentDb.Execute "insert into file_list (file_name) VALUES ('test.txt')"


Nov 12 '05 #3
Problem is half solved. I had to set zero length fields and that was
causing the error. But why do errors not get generated anyway? It would
be nice is the sql engine said "Field <a> has a problem"..

Would still like to find out how to print sql errors frp, currentdb.execute.

frank wrote:
I posted a question before (to too many groups) and this time I am
sending to this group only. I have a quick script as seen below, the
file_list table has a unique field called file_name.

The problem I am having is that if no unique items exist, this will
insert into the table fine. But if a unique item does exist it will not
insert as it should. My problem is that I can not get access to return
any kind of error. This is very frustrating as I have scowered the net
for what is a seemingly easy thing to do.

What am I doing wrong here? Is there a better way to do this? My real
program is a fairly big sql insert script repeated many times and it is
failing for one reason or another. But I cannot find out why because I
cannot print the errors that are returned.
db = CurrentDb()
CurrentDb.Execute "insert into file_list (file_name) VALUES (test.txt)"
MsgBox ("good")
Debug.Print Err.Description
Debug.Print Err.Number


Nov 12 '05 #4
Frank,

If you try

db.execute 'string', dbfailonerror

you should have the query feed some sort of error into your routine,
however, the Access query engine is not designed to teach you how to use
Access or to teach you SQL, that is something you must learn yourself and
from what I have seen, I would recommend you do a course (for your data and
sanity's sake!).

A VBA course would prolly be the best as things like VBA query options are
taught in it (I think...)

Best Regards
Antoin the...

"frank" <zi***@zip.com> wrote in message
news:HB*******************@bignews4.bellsouth.net. ..
Problem is half solved. I had to set zero length fields and that was
causing the error. But why do errors not get generated anyway? It would
be nice is the sql engine said "Field <a> has a problem"..

Would still like to find out how to print sql errors frp, currentdb.execute.
frank wrote:
I posted a question before (to too many groups) and this time I am
sending to this group only. I have a quick script as seen below, the
file_list table has a unique field called file_name.

The problem I am having is that if no unique items exist, this will
insert into the table fine. But if a unique item does exist it will not
insert as it should. My problem is that I can not get access to return
any kind of error. This is very frustrating as I have scowered the net
for what is a seemingly easy thing to do.

What am I doing wrong here? Is there a better way to do this? My real
program is a fairly big sql insert script repeated many times and it is
failing for one reason or another. But I cannot find out why because I
cannot print the errors that are returned.
db = CurrentDb()
CurrentDb.Execute "insert into file_list (file_name) VALUES (test.txt)" MsgBox ("good")
Debug.Print Err.Description
Debug.Print Err.Number

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) ...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
4
by: frank | last post by:
I posted a question before (to too many groups) and this time I am sending to this group only. I have a quick script as seen below, the file_list table has a unique field called file_name. The...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
7
by: Wayne Brantley | last post by:
I have found what appears to be an error in streaming with Datasets. It causes an error of 'Cannot find relation 0' when recreating the dataset from a stream. Here is how you reproduce it. ...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
2
by: dave | last post by:
Hi, I have searched for the answer for this error message without success. I have seen the question many times though:) I create an ASP.NET project (VS 2005, C#), and use a very simple .mdf...
3
by: =?Utf-8?B?UHJhaGFsYWQgRGVzaHBhbmRl?= | last post by:
Hi All, I am facing a show stopper problem with my development environment. I have VS2005 installed on my system. I wrote a simple C# application that does nothing more than print a Hello World...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.