473,748 Members | 5,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete record on popup-subform impossible?

Hi to all,

I am displaying a list of records in a subform which is embedded in a
popup main form (in order to ensure that users close the form when
leaving it).
It seems to be impossible to delete a record in this subform.

When I switched modal off and tried to delete a record from the list,
I deleted a record on another form (below the popup form).

Does anybody know how to do this?

(I hope the decription is somewhat understandable. )

Thanks in advance for any help!

Uwe
Nov 12 '05 #1
3 3973
"Uwe Range" <ur****@gmx.d e> wrote in message
news:64******** *************** ***@posting.goo gle.com...
Hi to all,

I am displaying a list of records in a subform which is embedded in a
popup main form (in order to ensure that users close the form when
leaving it).
It seems to be impossible to delete a record in this subform.

When I switched modal off and tried to delete a record from the list,
I deleted a record on another form (below the popup form).

Does anybody know how to do this?

(I hope the decription is somewhat understandable. )

Thanks in advance for any help!

Uwe


How have you tried to delete it? From the edit menu? By right-clicking the
subform and selecting delete? A button on the main form? You will have
problems with the first method if you want the main form to be modal, but
what about methods 2 and 3?

Fletcher


Nov 12 '05 #2
"Fletcher Arnold" <fl****@home.co m> wrote in message news:<bt******* ***@sparta.btin ternet.com>...
"Uwe Range" <ur****@gmx.d e> wrote in message
news:64******** *************** ***@posting.goo gle.com...
Hi to all,

I am displaying a list of records in a subform which is embedded in a
popup main form (in order to ensure that users close the form when
leaving it).
It seems to be impossible to delete a record in this subform.

When I switched modal off and tried to delete a record from the list,
I deleted a record on another form (below the popup form).

Does anybody know how to do this?

(I hope the decription is somewhat understandable. )

Thanks in advance for any help!

Uwe


How have you tried to delete it? From the edit menu? By right-clicking the
subform and selecting delete? A button on the main form? You will have
problems with the first method if you want the main form to be modal, but
what about methods 2 and 3?

Fletcher


First of all thanks for the hints.
I have tried all of this. Right-click doesn't give me a choice for
delete. I can only try the menu-delete, if the form is not modal. Then
it deletes the current record on the form below which is not set to
popup. I also tried to put a delete-button on the list-form (with the
button-wizard). It does the same as the menu-delete, because it uses
the menu-command. I would have liked to create my own delete button,
but I could not find a proper command for deleting a record ona form.
Is there one?

Uwe
Nov 12 '05 #3
"Uwe Range" <ur****@gmx.d e> wrote in message
news:64******** *************** ***@posting.goo gle.com...
"Fletcher Arnold" <fl****@home.co m> wrote in message

news:<bt******* ***@sparta.btin ternet.com>...
"Uwe Range" <ur****@gmx.d e> wrote in message
news:64******** *************** ***@posting.goo gle.com...
Hi to all,

I am displaying a list of records in a subform which is embedded in a
popup main form (in order to ensure that users close the form when
leaving it).
It seems to be impossible to delete a record in this subform.

When I switched modal off and tried to delete a record from the list,
I deleted a record on another form (below the popup form).

Does anybody know how to do this?

(I hope the decription is somewhat understandable. )

Thanks in advance for any help!

Uwe


How have you tried to delete it? From the edit menu? By right-clicking the subform and selecting delete? A button on the main form? You will have
problems with the first method if you want the main form to be modal, but what about methods 2 and 3?

Fletcher


First of all thanks for the hints.
I have tried all of this. Right-click doesn't give me a choice for
delete. I can only try the menu-delete, if the form is not modal. Then
it deletes the current record on the form below which is not set to
popup. I also tried to put a delete-button on the list-form (with the
button-wizard). It does the same as the menu-delete, because it uses
the menu-command. I would have liked to create my own delete button,
but I could not find a proper command for deleting a record ona form.
Is there one?

Uwe

My first (and simplest) suggestion is to find which shortcut menu opens when
you right-click the subform. Then customize this to make sure it contains
the delete button. This assumes you know something about customizing menus
and toolbars ... it is the same in lots of applications.

However, if you have started to look at code, then it might be good to learn
how it works rather than just using a wizard. Here is an example of code
that would do what you want. It assumes you have a table called
'tblMyTable' with a field 'ID' which is a number and is also the primary
key. The form has a button named 'cmdDelete' and a subform named 'sbfSub1'

Private Sub cmdDelete_Click ()

On Error GoTo Err_Handler

Dim dbs As DAO.Database
Dim lngID As Long
Dim strMsg As String
Dim strSQL As String

lngID = Nz(Me.sbfSub1.F orm!ID, 0)

If lngID = 0 Then
strMsg = "First select a record to delete"
MsgBox strMsg, vbExclamation
Exit Sub
End If

strMsg = "Are you sure you wish to delete record:" & vbCrLf & _
"ID = " & lngID & vbCrLf & _
"Other Info = ....(make sure user knows which record)"

If MsgBox(strMsg, vbExclamation Or vbYesNoCancel, _
"Confirm") <> vbYes Then
Exit Sub
End If

strSQL = "DELETE FROM tblMyTable WHERE ID=" & lngID

Set dbs = CurrentDb

dbs.Execute strSQL, dbFailOnError

If dbs.RecordsAffe cted = 1 Then
Me.sbfSub1.Form .Requery
Else
strMsg = "Cannot delete record"
MsgBox strMsg, vbCritical
End If

Exit_Handler:

If Not dbs Is Nothing Then
Set dbs = Nothing
End If

Exit Sub

Err_Handler:
MsgBox Err.Description , vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub


Nov 12 '05 #4

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

Similar topics

0
1141
by: James | last post by:
Does anyone know if there's an event fired when a datarow is deleted from a windows form datagrid? Or, I could even use a similar event from a dataview or dataset? Basically, I've got a Dataview bound to a data grid. I'd like to be able to popup a msgbox when the user chooses to delete a record, but I can't figure out if / when an event fires during the process of deleting a datarow. I've found a lot of posts on the delete event of a...
1
4457
by: Someonekicked | last post by:
I have a binary file, and I need to delete a specific number of characters in it. The file contains records, each record has a specific length. So the way I wanna handle deleting is that I will overwrite the record I want to delete with the last record in the file, then actually delete that last record in the file. the problem Im having is how to delete that last record in the file. Suppose each record is of length 43, then I have...
9
10663
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the table from which I want to delete has two foreign keys that references two other tables and it is also referenced by another table. But this shouldn't be a problem, since I set the commit mode to none (or *none) at all places where this makes...
4
7850
by: Susan Bricker | last post by:
I have a command button on a form that is supposed to Delete the record being displayed. The record is displayed one to a form. The form is not a Pop-Up nor is it Modal. Tracing the btnDelete event routine shows that AllowDeletions is TRUE. When the Delete button is clicked (without TRACE ON), I get a 'beep', the recordselector (vertical bar on left of form) gets dark in color, but the record is not deleted. Also, there is no error...
3
2102
by: John Rivers | last post by:
Hello, I think this will apply to alot of web applications: users want the ability to delete a record in table x this record is related to records in other tables and those to others in other tables etc. in other words we must use cascade delete to do
0
1511
by: laurent | last post by:
Environment: VS NET 2003 Fr Framework: 1.1 OS: WinXP SP2 Fr Hello I have a problem to add with pop-up and to delete in a datagrid(ButtonColumn delete) on WebForms. code button HTML which opens pop-up: <INPUT class="buttonForm" onclick="MM_openBrWindow('../pages/recherche_ar.aspx?a=2','AR','width=700,height=500,scrollbars=yes,resizable=yes')"
3
4757
by: JN | last post by:
I am using the sqldatasource to populate a gridview and I have a pop up that fires when the item_deleting event is triggered. Now in the popup, if the user clicks cancel, i dont want the delete query to continue. How do I accomplish this? Thanks. JN
5
1974
by: Gareith Stanley | last post by:
Hi there I have an access form that allows the user to browse records (< and > buttons) sorted by another field within that table (eg, all entries under a staff group, all entries under a student group). I have added a delete button to the form using code supplied by another user of the forum (thanks to PEB): Dim rst As Recordset Set rst = Me.RecordsetClone
4
2585
by: Craggy | last post by:
Hi, I am trying to pop up a yes/no message box so that a user can delete a record in a continuous form. The default delete message is a bit sloppy because it seems to move the continuous form to the position of the record u want to delete. If you then choose to not to delete the record it looks to a user as if it has deleted every record before the one you chose not to delete. To get around this I made a yes/no msgbox pop up and only after...
5
3942
by: sh26 | last post by:
I can Add and Delete (A, CName, MX and TXT) Dns records on the Dns Server using C# code. The problem I am having is if someone manaully creates a TXT record on the Dns Server, I cannot delete that particular record using the same C# code. Here is what I am using to delete the records: public void DeleteRecord(string domain, string recordName, string recordType, string recordData) { try { ...
0
8830
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
9544
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...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
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...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
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
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.