Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update Query 1

Status
Not open for further replies.

Zeroanarchy

Technical User
Jun 11, 2001
630
AU
Ok I am trying to import several records at the same time which do not have an ID no, so I tried the following code in the last field in hope that it would add each record to the new table with a ID no. but of course I get the following error "Key Violation" and only one record is added. anyone got a better method??

Expr2: DMax("weedregisterid","Regestration")+1


Thanks

Zero Anarchy Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.
 
Hi

Is IdNo an autonumber? if yes you do not need to provide a value, it will generate its own

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reay@talk21.com
 
Nup I changed it over to a self generated number in the form but what I am trying to do is come up with a method that will add the next record to the end.

thanks
Zero Anarchy Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.
 
If your weedregisterid is an autonumber, just append the rows. If not, two possible solutions are:

1) Copy the Regestration table structure. Modify the weedregisterid to autonumber. Use DMax("weedregisterid","Regestration")+[weedregisterid] to append the rows.

2) If you have another unique field in the rows you are appending, use DMax(&quot;weedregisterid&quot;,&quot;Regestration&quot;) + Dcount(&quot;[{other unique field}]&quot;,&quot;{table to be appended from}&quot;,&quot;[{other unique field}] <=&quot; & {other unique field}) (syntax may not be exactly correct). This will add the registration number plus the number of records where the unique identifier is less than or equal to and give you a unique registration id.

Other users may have better solutions.
 
thanks joshuar thats what I was looking for, I knew there was a method of doing it but could not quite get my head around it.

Have a star for your efforts.

Zeroanarchy Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top