473,623 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re-creating a deleted record and keeping the same value in an Autonumber field

I've inherited a system that was designed by someone with no
understanding of database design. From the logical design point of
view, there is no logical design. The physical design is a nightmare.
e.g. there are no relationships between tables and foreign keys appear
to have been sprinkled at random like confetti. As an example, the
Employer - Employee - Contract - Expense hierarchy has EmployerID in
the Expense table. That's the background.

Someone has deleted a Contract record. I need to re-create it with the
same ContractID, an Autonumber field. I can open the table in design
view, change the Autonumber to a Long, go to datasheet view and add
the new record. Then if I open the table in design view, do a save as
with another name, change the key field in the new table back to an
Autonumber, I can run an append query to copy all the records from the
old table to the new one while keeping the Autonumber field values. A
bit of table re-naming, and we've got the old record restored.

I've tested it and it seems to work OK.

Are there any problems with this?

Regards,
Richard.
--
Regards.
Richard.
Jun 27 '08 #1
2 2042
Might be some problems w/ referential integrity, but it sounds like
that might not be in force.

However, you can run an append query against an autonumber field and
restore the value that way. Lemme know if that interests you and
you're having any troubles. You might have to go to VBA to do a
docmd.runsql statement.

Anyway, changing the data via query should be a more elegant solution
to a sub-optimal application.

best of luck,

Tim Mills-Groninger

On Jun 10, 5:52*am, Richard Sherratt
<richard.sherr. ..@NOTHINGHEREb runsley.com.auw rote:
I've inherited a system that was designed by someone with no
understanding of database design. From the logical design point of
view, there is no logical design. The physical design is a nightmare.
e.g. there are no relationships between tables and foreign keys appear
to have been sprinkled at random like confetti. As an example, the
Employer - Employee - Contract - Expense hierarchy has EmployerID in
the Expense table. That's the background.

Someone has deleted a Contract record. I need to re-create it with the
same ContractID, an Autonumber field. I can open the table in design
view, change the Autonumber to a Long, go to datasheet view and add
the new record. Then if I open the table in design view, do a save as
with another name, change the key field in the new table back to an
Autonumber, I can run an append query to copy all the records from the
old table to the new one while keeping the Autonumber field values. A
bit of table re-naming, and we've got the old record restored.

I've tested it and it seems to work OK.

Are there any problems with this?

Regards,
Richard.
--
Regards.
Richard.
Jun 27 '08 #2
On Tue, 10 Jun 2008 09:51:25 -0700 (PDT), timmg
<tm************ *@gmail.comwrot e:
>Might be some problems w/ referential integrity, but it sounds like
that might not be in force.

However, you can run an append query against an autonumber field and
restore the value that way. Lemme know if that interests you and
you're having any troubles. You might have to go to VBA to do a
docmd.runsql statement.

Anyway, changing the data via query should be a more elegant solution
to a sub-optimal application.

best of luck,

Tim Mills-Groninger
Thanks, Tim.

Normalisation, logical database design and referential integrity are
just three of the terms that were not allowed to interfere in the
original cobbling together of this system :-)

--
Regards.
Richard.
Jun 27 '08 #3

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

Similar topics

1
4283
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would be better to promote better programming than rely on PHP to compensate for lazy programming?
4
6416
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as well as some color coding, etc. Having trouble finding the same in an editor that'll run on OS X. -- Floydian Slip(tm) - "Broadcasting from the dark side of the moon"
1
4089
by: Chris | last post by:
Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm going wrong? Thanks in advance and sorry again for adding so much code... <TABLE border="1" bordercolor="#000000" cellspacing="0"> <TR>
11
3997
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
4
18522
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function blocks until something.exe terminates. Just what I /don't/ want. (Wouldn't an & be nice here! Sigh) I need something.exe to disconnect and run in the background while I
1
3693
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with sockets??
10
4211
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
8
4409
by: Beowulf | last post by:
Hi Guru's, I have a query regarding using PHP to maintain a user profiles list. I want to be able to have a form where users can fill in their profile info (Name, hobbies etc) and attach an image, which will upload the record to a mySql db so users can then either view all profiles or query.. I.e. show all males in UK, all femails over 35 etc. Now, I'm not asking for How to do this but more what would be the best way? I've looked at...
1
3630
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id NOT IN ( SELECT manufacturers_id FROM products )
3
3472
by: presspley | last post by:
I have bought the book on advanced dreamweaver and PHP recently. I have installed MySQL and PHP server but am getting an error on the $GET statement show below. It says there is a problem with the variable $GET but $GET is not a variable, I thought it came from the page that calls the PHP file? if(($_GET)==""){ this gets an error
0
8160
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8661
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4067
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2590
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1467
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.