A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Key violation problem when i import the text file



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2008, 05:05 PM posted to microsoft.public.access.tablesdbdesign
[email protected]
external usenet poster
 
Posts: 3
Default Key violation problem when i import the text file

Hi:

I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.

It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  #2  
Old June 5th, 2008, 06:48 PM posted to microsoft.public.access.tablesdbdesign
Golfinray
external usenet poster
 
Posts: 1,597
Default Key violation problem when i import the text file

If you are trying to create a key when a key is already there, that won'
work. Go the design view of the table, remove the key, set the field types
for your records, and then try and import. Or import the file, then go in and
set or reset the key and name the fields and types as needed.

" wrote:

Hi:

I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.

It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  #3  
Old June 5th, 2008, 07:14 PM posted to microsoft.public.access.tablesdbdesign
[email protected]
external usenet poster
 
Posts: 3
Default Key violation problem when i import the text file

On Jun 5, 1:48 pm, Golfinray
wrote:
If you are trying to create a key when a key is already there, that won'
work. Go the design view of the table, remove the key, set the field types
for your records, and then try and import. Or import the file, then go in and
set or reset the key and name the fields and types as needed.

" wrote:
Hi:


I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.


It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



yes that's rite. but i want Access to create it automatically. is
that possible when i import the file.
bcuz it works in 97 version, i suppose there must be a way to do that
in 2003.

for instance: the import file is :
2008401 333 222 110
2008401 333 222 111
2008401 333 222 112
2008402 333 222 113

when i import this in 97version, it automatically create the PK. looks
like:
KEY DATE NUM NUM NUM
1 2008401 333 222 110
2 2008401 333 222 111
3 2008401 333 222 112
4 2008402 333 222 113

But it doesnt work in 2003. Do you know how to fix this?
  #4  
Old June 5th, 2008, 07:36 PM posted to microsoft.public.access.tablesdbdesign
Golfinray
external usenet poster
 
Posts: 1,597
Default Key violation problem when i import the text file

Delete the key you have now and when you import it will ask if you to allow
access to create a key. Say yes and it will create an autonumber field, but
not if one is already there.

" wrote:

On Jun 5, 1:48 pm, Golfinray
wrote:
If you are trying to create a key when a key is already there, that won'
work. Go the design view of the table, remove the key, set the field types
for your records, and then try and import. Or import the file, then go in and
set or reset the key and name the fields and types as needed.

" wrote:
Hi:


I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.


It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



yes that's rite. but i want Access to create it automatically. is
that possible when i import the file.
bcuz it works in 97 version, i suppose there must be a way to do that
in 2003.

for instance: the import file is :
2008401 333 222 110
2008401 333 222 111
2008401 333 222 112
2008402 333 222 113

when i import this in 97version, it automatically create the PK. looks
like:
KEY DATE NUM NUM NUM
1 2008401 333 222 110
2 2008401 333 222 111
3 2008401 333 222 112
4 2008402 333 222 113

But it doesnt work in 2003. Do you know how to fix this?

  #5  
Old June 5th, 2008, 09:32 PM posted to microsoft.public.access.tablesdbdesign
[email protected]
external usenet poster
 
Posts: 3
Default Key violation problem when i import the text file

On Jun 5, 2:36 pm, Golfinray
wrote:
Delete the key you have now and when you import it will ask if you to allow
access to create a key. Say yes and it will create an autonumber field, but
not if one is already there.

" wrote:
On Jun 5, 1:48 pm, Golfinray
wrote:
If you are trying to create a key when a key is already there, that won'
work. Go the design view of the table, remove the key, set the field types
for your records, and then try and import. Or import the file, then go in and
set or reset the key and name the fields and types as needed.


" wrote:
Hi:


I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.


It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


yes that's rite. but i want Access to create it automatically. is
that possible when i import the file.
bcuz it works in 97 version, i suppose there must be a way to do that
in 2003.


for instance: the import file is :
2008401 333 222 110
2008401 333 222 111
2008401 333 222 112
2008402 333 222 113


when i import this in 97version, it automatically create the PK. looks
like:
KEY DATE NUM NUM NUM
1 2008401 333 222 110
2 2008401 333 222 111
3 2008401 333 222 112
4 2008402 333 222 113


But it doesnt work in 2003. Do you know how to fix this?


Thank you a lot ........
do you mind just one more question..

i just want a form to support several parameters for report.it has
nothing to do wi query.
for example: i want the user to enter the parameter when they open the
report, then what they entered directly go into the specific place i
specify.
For the original one i just put something like "=[Enter the Invoice
Number]"

"=[Enter the beginning date]"

"=[Enter the ending date]" at different place in report.
I just want a form to support several parameters. I use " Forms!
[input]![Label1]"

" Forms![input]![Label2]"..........however it doesnt work..



Really thx for your help!!!!!!!
  #6  
Old June 5th, 2008, 09:50 PM posted to microsoft.public.access.tablesdbdesign
Golfinray
external usenet poster
 
Posts: 1,597
Default Key violation problem when i import the text file

I think you need =forms![input].label2

" wrote:

On Jun 5, 2:36 pm, Golfinray
wrote:
Delete the key you have now and when you import it will ask if you to allow
access to create a key. Say yes and it will create an autonumber field, but
not if one is already there.

" wrote:
On Jun 5, 1:48 pm, Golfinray
wrote:
If you are trying to create a key when a key is already there, that won'
work. Go the design view of the table, remove the key, set the field types
for your records, and then try and import. Or import the file, then go in and
set or reset the key and name the fields and types as needed.


" wrote:
Hi:


I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a few
records can be imported to the table, and it does not create the
primary key for it.


It works pretty well in 97 version, i just converted it to 2003
version,


Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


yes that's rite. but i want Access to create it automatically. is
that possible when i import the file.
bcuz it works in 97 version, i suppose there must be a way to do that
in 2003.


for instance: the import file is :
2008401 333 222 110
2008401 333 222 111
2008401 333 222 112
2008402 333 222 113


when i import this in 97version, it automatically create the PK. looks
like:
KEY DATE NUM NUM NUM
1 2008401 333 222 110
2 2008401 333 222 111
3 2008401 333 222 112
4 2008402 333 222 113


But it doesnt work in 2003. Do you know how to fix this?


Thank you a lot ........
do you mind just one more question..

i just want a form to support several parameters for report.it has
nothing to do wi query.
for example: i want the user to enter the parameter when they open the
report, then what they entered directly go into the specific place i
specify.
For the original one i just put something like "=[Enter the Invoice
Number]"

"=[Enter the beginning date]"

"=[Enter the ending date]" at different place in report.
I just want a form to support several parameters. I use " Forms!
[input]![Label1]"

" Forms![input]![Label2]"..........however it doesnt work..



Really thx for your help!!!!!!!

  #7  
Old June 7th, 2008, 12:34 AM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Key violation problem when i import the text file

A caveat about deleting a Primary Key/autonumber field ...

If that Primary Key is used in any other tables (as a foreign key), deleting
the field will "orphan" those related records in the other tables.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Golfinray" wrote in message
...
Delete the key you have now and when you import it will ask if you to
allow
access to create a key. Say yes and it will create an autonumber field,
but
not if one is already there.

" wrote:

On Jun 5, 1:48 pm, Golfinray
wrote:
If you are trying to create a key when a key is already there, that
won'
work. Go the design view of the table, remove the key, set the field
types
for your records, and then try and import. Or import the file, then go
in and
set or reset the key and name the fields and types as needed.

" wrote:
Hi:

I create a table with 5 field without any records, and i want to
import a text file to update the table. I have a field "ID" which is
primary key for the table, i set it to be "autonumber". When i import
the external file, it says "error due to key violation".and only a
few
records can be imported to the table, and it does not create the
primary key for it.

It works pretty well in 97 version, i just converted it to 2003
version,

Anybody can help?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



yes that's rite. but i want Access to create it automatically. is
that possible when i import the file.
bcuz it works in 97 version, i suppose there must be a way to do that
in 2003.

for instance: the import file is :
2008401 333 222 110
2008401 333 222 111
2008401 333 222 112
2008402 333 222 113

when i import this in 97version, it automatically create the PK. looks
like:
KEY DATE NUM NUM NUM
1 2008401 333 222 110
2 2008401 333 222 111
3 2008401 333 222 112
4 2008402 333 222 113

But it doesnt work in 2003. Do you know how to fix this?



 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.