473,387 Members | 1,942 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,387 software developers and data experts.

AK2 Failure to delete

Deleting a record on a membership form. Does some VB checks to see if the
family are still in the list. Warns me there is no going back if I delete
the record, so I say OK and it appears to delete OK.
Record count goes down by 1, but if I select "ShowAllRecords", there he is
back and the recordCount back to the original value

Theories gratefully received

Phil
Apr 4 '07 #1
2 1766
Are you using a custom button to delete the record? If so, we need to see the
code you're using behind this button.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200704/1

Apr 4 '07 #2
Thanks for coming back

Not actually using a button, just the record bar on the left, but the
following code runs on the OnDelete Event =CheckFamily(2)

Notes:-
Each Member has a field called MemHeadOfHouseID. This is equal to MemberID
for (Sorry to be sexist) the Alpha Male, and the wife & children will all
have the same MemHeadOfHouseID. That is what links the family together.

The CheckSpace check another table to see if there is a matching record for
MemberID

As you can see, - no cancels anywhere. Incidently written originally 11
years ago, probable Access2. As far as I know, has always worked, but it may
not have been tried as I normally flad members as having resigned, died etc
and they then get archived.

Function CheckFamily(code) ' On delete or resignation of Head
of family

' APS, 6 Jan 96, Warn if family of MemHeadOfHouseID not marked as
resigned
' if head of house no longer active

Dim MyDb As Database
Dim MyQuery As Recordset
Dim Frm As Form, SFrm As Form
Dim Criteria As String
Static Activity(1 To 4) As String

Set MyDb = CurrentDb()
Set MyQuery = MyDb.OpenRecordset("Member", DB_OPEN_DYNASET) ' Open
MemberTable
Set Frm = Forms!Member

If Frm!MemHead = False Then GoTo CheckSpace
Activity(1) = " is active"
Activity(2) = " has resigned"
Activity(3) = " has died"
Activity(4) = " has not rejoined"

Criteria = "MemHeadOfHouseID = " & Frm!MemberID ' Define search
criteria for the member

Select Case code

Case 1 ' afterUpdate of form on retirement
etc
' of HeadOfHouseID
MyQuery.FindFirst Criteria ' Locate first occurrence.
Do Until MyQuery.NoMatch ' Loop until no matching records.
If Frm!MemRetired <1 Then ' Head of House no longer active
If MyQuery!MemRetired <Frm!MemRetired Then
MsgBox "Member " & MyQuery!MemFirstName & " " &
MyQuery!MemSurName & Activity(MyQuery!MemRetired)
End If
End If
MyQuery.FindNext Criteria ' Locate next record.
Loop ' End of loop.

Case 2 ' afterUpdate of form on deleting
HeadOfHouseID

MyQuery.FindFirst Criteria ' Locate first occurrence.
Do Until MyQuery.NoMatch ' Loop until no matching records.
If MyQuery!MemberID <Frm!MemberID Then ' Someone
else
MsgBox "Member's family " & MyQuery!MemFirstName & " " &
MyQuery!MemSurName & " is still on file"
End If
MyQuery.FindNext Criteria ' Locate next record.
Loop ' End of loop.
End Select
MyQuery.Close ' Close table.
Set MyQuery = Nothing

Frm!MemHeadOfHouseID.Requery
Frm!EMemAddID.Requery

CheckSpace: ' Check if Member owns a
boat space
If Frm!MemRetired = 1 Then Exit Function ' Only applies to
members who are not active
Set MyQuery = MyDb.OpenRecordset("jnMemSpace", DB_OPEN_DYNASET) ' Open
Member Space Table
Criteria = "MemberID = " & Frm!MemberID ' Define search criteria
for the member's space
MyQuery.FindFirst Criteria ' Locate first
occurrence.
Do Until MyQuery.NoMatch ' Loop until no matching
records.
MsgBox "Member " & Frm!MemFirstName & " " & Frm!MemSurName & " has
space No: " & MyQuery!SpaceID
MyQuery.FindNext Criteria ' Locate next record.
Loop ' End of loop.
MyQuery.Close
Set MyQuery = Nothing
Set MyDb = Nothing

End Function
"missinglinq via AccessMonster.com" <u28780@uwewrote in message
news:7036690bd78cf@uwe...
Are you using a custom button to delete the record? If so, we need to see
the
code you're using behind this button.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200704/1

Apr 4 '07 #3

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

Similar topics

4
by: August1 | last post by:
i'm having difficulties with the execution of a program, i believe due to something i am missing in the copy constructor implementation. When i create one object of the class and run the program...
4
by: Dave | last post by:
Hello all, In the program below, why am I not seeing operator delete being invoked? If a constructor throws, isn't allocated memory supposed to be released and then the exception re-propagated?...
6
by: N. Graves | last post by:
Thank you for taking your time to read my question... please offer your knowledge it will be appreciated! I'm writing a ASP Web page to access a Access Database that has a Database Password set....
24
by: anders | last post by:
Hi! Im trying to add a A record to a domain name in MS DNS with C#, it's done from a webpage with this code: ManagementClass rr = new ManagementClass(@"root\MicrosoftDNS",...
2
by: Gill Smith | last post by:
While compiling my ASP.Net application, I am getting the following error message "A failure occurred writing to the resources file. Access is denied." Why I am geeting this error message and how to...
1
by: John Siracusa | last post by:
We had a power failure (and a UPS failure) on our database machine. It's back up now but some spooky stuff is happening. Here's an example: (Names changed to protect the guilty.) First, the...
9
by: Bern McCarty | last post by:
I am porting stuff from MEC++ syntax to the new C++/CLI syntax. Something that we did in the old syntax that proved to be very valuable was to make sure that the finalizer would purposefully...
2
by: Oliver Bleckmann | last post by:
seems as if the definition in the header file is ignorred `setVon' has not been declared here is the main code and reservation header file the actual part is commented out and repeated at the end...
4
by: IanWright | last post by:
I'm struggling with an assertion failure and was wondering if anyone can help. I understand why its failing, but don't quite have the C++ knowledge to be able to decide how it should be fixed... ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.