473,222 Members | 1,738 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,222 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 2077
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.