473,561 Members | 3,917 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 3958
"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
1123
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...
1
4440
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...
9
10616
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...
4
7838
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...
3
2094
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
1491
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"...
3
4741
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
1963
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...
4
2553
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...
5
3906
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,...
0
7639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7562
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...
0
7855
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. ...
0
8074
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5465
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...
0
3613
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...
1
2058
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
1172
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
885
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...

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.