I am designing a db to automate an old cemetery’s records. A grave’s location is designated by its Section, Row and Lot number, which are separate text fields in the Lot Table. I have created a query with a calculated field, SecRowLot, that concatenates the three text fields. I used an Append Query to populate the SecRowLot field in the Lot Table. I have a LotUpdate form for entering new lot purchases. The form has a SecRowLot field, based on the Lot Query. This field calculates correctly on the form (courtesy of the query) but does not store the value in the Lot Table. I want to store it while checking that this value is not duplicated in the table. (The current occupants of the lot might not appreciate a newcomer.) How do I do this?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Access 97 calculated field
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Access 97 calculated field
- This topic has 12 replies, 5 voices, and was last updated 23 years, 12 months ago.
AuthorTopicWSHoward Hillman
AskWoody LoungerApril 19, 2001 at 9:21 pm #355184Viewing 1 reply threadAuthorReplies-
WSPaulK
AskWoody LoungerApril 19, 2001 at 9:32 pm #523385I’m not sure I follow you entirely but I wouldn’t recommend storing a calculated value in a table unless you have a very good reason – it can create havoc when deleteing and updating values that the calculation is based. Besides, you can recreate it in a query as you have. I would create a unique index of the 3 fields – that would prevent the addition of a duplicate value. Of course this would happen at the end of an update so you may want to provide a way to check for duplicates as soon as the new lot is entered. There are several ways to do this but probably the easiest is with the recordsetclone property. Take a look at the online ehpl for this property – there should be some decent examples that can point you in the right direction.
-
WSHoward Hillman
AskWoody LoungerApril 20, 2001 at 4:31 pm #523502Paul, thanks for the info. I researched RecordsetClone and think I know how to proceed. Should I use the FindFirst method to test for existing value? Consider the following complications:
I tried to create a unique index on the 3 fields but was stymied by data format. Some entries are blank because the cemetery layout varies all over the lot (pun intended.) For example, section F has no rows, only lots, so a location might be “F blank 23”, while section H might be “H 7 31”. That’s why I created my calculated value SecRowLot. Can I use the Recordset clone to test for duplicate SecRowLot values that exist in other records? -
WSRupert
AskWoody Lounger -
WSHoward Hillman
AskWoody Lounger
-
-
-
-
WSJerryC
AskWoody Lounger -
WSHoward Hillman
AskWoody LoungerMay 14, 2001 at 3:16 pm #526049Thanks for the response, but…
Now we’re back to square one. PaulK said in his post it’s not a good idea to store a calculated field in the table. If I really want to, should I use an Append Query to add the calculated field?I really have two problems here:
1. Find any duplicates in existing data. I’ve solved that with a query on the SecRowLot calculated field, which found about 40 duplicates.2. Once those are cleaned up, how do I test new data for duplicates? Store the calculated field in the table? (how?) Or, use the RecordsetClone method referred to by PaulK. I posted a question about that, with no reply.
-
WSPaulK
AskWoody LoungerMay 14, 2001 at 3:42 pm #526056Don’t store calculated values unless you have a good reason…and in this case you may have a good enough reason. Another thing to consider is how likely is it that the components of the calculated value will change. Only you can decide that but it seems to me that the occupants of the grave sites will not be changing or moving around that much.
Another alternative to consider is to enter a standard value in the component that doesn’t exist like BLANK or NA then remove it using IIF() when you recreate it in the query. This should allow you to create a unique three field index and prevent future dups.
Let me know which way you want to proceed and if you need further help. I’d be happy to help if needed.
-
WSHoward Hillman
AskWoody LoungerMay 17, 2001 at 3:53 pm #526509Paul, many thanks for the suggestions. After much thought and discussion with the cemetery folks we’ve decided to clean up the data, then pad the blank Rows with a “phantom” entry like 99. Then all sections will have consistent data for Section, Row and Lot. Then I can create a three-field index, no duplicates.
I tried that on a small subset of clean data and it works fine. When I enter duplicate data and save the record, Access gives me a long-winded error msg saying I’ve entered duplicate data or committed some other infraction. That will work fine for now, but I plan to put some code in the Form to make the msg shorter for the users. I’l probably use the After Update event in the Row field to trigger code that uses Recordset and FindFirst to check if this value already exists. I’ll let you know how that works out.
-
WSPaulK
AskWoody Lounger -
WSabach
AskWoody LoungerMay 19, 2001 at 2:02 am #526712 -
WSHoward Hillman
AskWoody Lounger -
WSabach
AskWoody LoungerMay 21, 2001 at 3:36 pm #526920The code is listed below. Please check it first, as I am on my way out and have not tested it as written. If it gives your problems, let me know..
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo On Error GoTo HandleErr
Dim strMsg As String
strMsg = “Data has changed.”
strMsg = strMsg & “Do you wish to save the changes?”
strMsg = strMsg & “Click Yes to Save or No to Discard changes.”
If MsgBox(strMsg, vbQuestion + vbYesNo, “Save Record?”) = vbYes ThenElse
DoCmd.RunCommand acCmdUndoEnd If
ExitHere:
Exit SubHandleErr:
Select Case Err.Number
Case 2501
Resume Next
Case 3022
If MsgBox(“Record already exists” & vbCrLf & _
vbTab & “Cancel Entry?”, vbYesNo + vbCritical, “Wait”) = vbYes Then
MsgBox “The entry has been cancelled”, , “Cancelled”
DoCmd.RunCommand acCmdUndo
End If
Case Else
MsgBox Err.Description & ” ” & Err.Number
Resume Exit_cmdSave_Click
End Select
-
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Outdated Laptop
by
jdamkeene
42 minutes ago -
Updating Keepass2Android
by
CBFPD-Chief115
3 hours, 3 minutes ago -
Another big Microsoft layoff
by
Charlie
2 hours, 43 minutes ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
2 hours, 32 minutes ago -
May 2025 updates are out
by
Susan Bradley
3 hours, 8 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
8 hours, 47 minutes ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
8 hours, 49 minutes ago -
Drivers suggested via Windows Update
by
Tex265
8 hours, 40 minutes ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
6 hours, 24 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
15 hours, 39 minutes ago -
Apple releases 18.5
by
Susan Bradley
10 hours, 4 minutes ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
17 hours, 5 minutes ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
17 hours, 43 minutes ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
59 minutes ago -
No HP software folders
by
fpefpe
1 day, 1 hour ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
22 minutes ago -
Stay connected anywhere
by
Peter Deegan
1 day, 6 hours ago -
Copilot, under the table
by
Will Fastie
22 hours ago -
The Windows experience
by
Will Fastie
1 day, 13 hours ago -
A tale of two operating systems
by
Susan Bradley
1 day, 3 hours ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
1 day, 18 hours ago -
Where’s the cache today?
by
Up2you2
2 days, 9 hours ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
2 days, 2 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
1 day, 2 hours ago -
Blocking Search (on task bar) from going to web
by
HenryW
5 hours, 1 minute ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
3 days, 2 hours ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
3 days, 3 hours ago -
regarding april update and may update
by
heybengbeng
3 days, 4 hours ago -
MS Passkey
by
pmruzicka
2 days, 6 hours ago -
Can’t make Opera my default browser
by
bmeacham
3 days, 12 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.