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

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 3942
"Uwe Range" <ur****@gmx.de> wrote in message
news:64**************************@posting.google.c om...
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.com> wrote in message news:<bt**********@sparta.btinternet.com>...
"Uwe Range" <ur****@gmx.de> wrote in message
news:64**************************@posting.google.c om...
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.de> wrote in message
news:64**************************@posting.google.c om...
"Fletcher Arnold" <fl****@home.com> wrote in message

news:<bt**********@sparta.btinternet.com>...
"Uwe Range" <ur****@gmx.de> wrote in message
news:64**************************@posting.google.c om...
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.Form!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.RecordsAffected = 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
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...
1
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...
9
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...
4
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...
3
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...
0
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...
3
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...
5
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...
4
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
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
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,...
0
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...
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,...
0
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...

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.