Connecting Tech Pros Worldwide Help | Site Map

deleting records

DP
Guest
 
Posts: n/a
#1: Feb 23 '06
hi,

i've got a form, with a subform in it. i've got a delete button in the
subform. the code i;ve got is;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
Me.FilmID

Recordset.Delete


Else
MsgBox "You cancelled the delete operation"

End If

End Sub

so when i lcick the delete button, i get the following error;


runtime error 3197

The Microsoft Jet Database Engine stopped becasue you and another user are
attempting to change the same data at the same time.


how can i overcome this error, as if i close the DB, and then open it again,
it will delete the record, and update the correct field?? (currently i have
to press the delete button twice to delete a record)

thanx



PC Datasheet
Guest
 
Posts: n/a
#2: Feb 23 '06

re: deleting records


Error 3197 will occur if you have another form open that displays the same
record. Do you have another form open?

An easier way to delete a record is to put the following code in the double
click event of any field on your form:

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
resource@pcdatasheet.com


"DP" <DP@hotmail.com> wrote in message
news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...[color=blue]
> hi,
>
> i've got a form, with a subform in it. i've got a delete button in the
> subform. the code i;ve got is;
>
> Private Sub cmdDeleteRecord_Click()
>
> msg = "Are you sure you want to delete this film rental record?"
> Style = vbYesNo + vbQuestion + vbDefaultButton2
>
> Response = MsgBox(msg, Style, "Film Rental Database")
> If Response = vbYes Then
>
> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
> Me.FilmID
>
> Recordset.Delete
>
>
> Else
> MsgBox "You cancelled the delete operation"
>
> End If
>
> End Sub
>
> so when i lcick the delete button, i get the following error;
>
>
> runtime error 3197
>
> The Microsoft Jet Database Engine stopped becasue you and another user are
> attempting to change the same data at the same time.
>
>
> how can i overcome this error, as if i close the DB, and then open it
> again,
> it will delete the record, and update the correct field?? (currently i
> have
> to press the delete button twice to delete a record)
>
> thanx
>
>
>[/color]


Rob Oldfield
Guest
 
Posts: n/a
#3: Feb 23 '06

re: deleting records


To the original poster:

It is commonly accepted that these newsgroups are for free exchange of
information. Please be aware that PC Datasheet is a notorious job hunter.
If you are considering doing business with him then I suggest that you take
a look at the link below first.

http://home.tiscali.nl/arracom/whoissteve.html


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:jjpLf.2875$5M6.1878@newsread2.news.atl.earthl ink.net...[color=blue]
> Error 3197 will occur if you have another form open that displays the same
> record. Do you have another form open?
>
> An easier way to delete a record is to put the following code in the[/color]
double[color=blue]
> click event of any field on your form:
>
> DoCmd.SetWarnings False
> DoCmd.RunCommand acCmdDeleteRecord
> DoCmd.SetWarnings True
>
> --
> PC Datasheet
> Your Resource For Help With Access, Excel And Word Applications
> Over 1125 users have come to me from the newsgroups requesting help
> resource@pcdatasheet.com
>
>
> "DP" <DP@hotmail.com> wrote in message
> news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...[color=green]
> > hi,
> >
> > i've got a form, with a subform in it. i've got a delete button in the
> > subform. the code i;ve got is;
> >
> > Private Sub cmdDeleteRecord_Click()
> >
> > msg = "Are you sure you want to delete this film rental record?"
> > Style = vbYesNo + vbQuestion + vbDefaultButton2
> >
> > Response = MsgBox(msg, Style, "Film Rental Database")
> > If Response = vbYes Then
> >
> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> >
> > Recordset.Delete
> >
> >
> > Else
> > MsgBox "You cancelled the delete operation"
> >
> > End If
> >
> > End Sub
> >
> > so when i lcick the delete button, i get the following error;
> >
> >
> > runtime error 3197
> >
> > The Microsoft Jet Database Engine stopped becasue you and another user[/color][/color]
are[color=blue][color=green]
> > attempting to change the same data at the same time.
> >
> >
> > how can i overcome this error, as if i close the DB, and then open it
> > again,
> > it will delete the record, and update the correct field?? (currently i
> > have
> > to press the delete button twice to delete a record)
> >
> > thanx
> >
> >
> >[/color]
>
>[/color]


DP
Guest
 
Posts: n/a
#4: Feb 24 '06

re: deleting records


well yea, i have the main form open. it does not display the same record,
but it does display the same membershipID which is in the subform. (which is
wat i;m trying to delete)

how would the code u gave me help? as u would have to double click each
field wouldnt u?

dev

"PC Datasheet" <nospam@nospam.spam> wrote in message
news:jjpLf.2875$5M6.1878@newsread2.news.atl.earthl ink.net...[color=blue]
> Error 3197 will occur if you have another form open that displays the same
> record. Do you have another form open?
>
> An easier way to delete a record is to put the following code in the[/color]
double[color=blue]
> click event of any field on your form:
>
> DoCmd.SetWarnings False
> DoCmd.RunCommand acCmdDeleteRecord
> DoCmd.SetWarnings True
>
> --
> PC Datasheet
> Your Resource For Help With Access, Excel And Word Applications
> Over 1125 users have come to me from the newsgroups requesting help
> resource@pcdatasheet.com
>
>
> "DP" <DP@hotmail.com> wrote in message
> news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...[color=green]
> > hi,
> >
> > i've got a form, with a subform in it. i've got a delete button in the
> > subform. the code i;ve got is;
> >
> > Private Sub cmdDeleteRecord_Click()
> >
> > msg = "Are you sure you want to delete this film rental record?"
> > Style = vbYesNo + vbQuestion + vbDefaultButton2
> >
> > Response = MsgBox(msg, Style, "Film Rental Database")
> > If Response = vbYes Then
> >
> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> >
> > Recordset.Delete
> >
> >
> > Else
> > MsgBox "You cancelled the delete operation"
> >
> > End If
> >
> > End Sub
> >
> > so when i lcick the delete button, i get the following error;
> >
> >
> > runtime error 3197
> >
> > The Microsoft Jet Database Engine stopped becasue you and another user[/color][/color]
are[color=blue][color=green]
> > attempting to change the same data at the same time.
> >
> >
> > how can i overcome this error, as if i close the DB, and then open it
> > again,
> > it will delete the record, and update the correct field?? (currently i
> > have
> > to press the delete button twice to delete a record)
> >
> > thanx
> >
> >
> >[/color]
>
>[/color]


PC Datasheet
Guest
 
Posts: n/a
#5: Feb 24 '06

re: deleting records


If your subform is a continuous form, all the fields in any row comprise a
record. You could put the code in the double click event of any field in a
row and when you double clicked on that field, the entire record would be
deleted. If your subform is a single form, all the fields you see in the
subform at any point in time comprise a record. You could put the code in
the double click event of any field in the subform and when you double
clicked on that field, the entire record would be deleted.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
resource@pcdatasheet.com



"DP" <DP@hotmail.com> wrote in message
news:g8GLf.35537$Fy4.23922@newsfe4-win.ntli.net...[color=blue]
> well yea, i have the main form open. it does not display the same record,
> but it does display the same membershipID which is in the subform. (which
> is
> wat i;m trying to delete)
>
> how would the code u gave me help? as u would have to double click each
> field wouldnt u?
>
> dev
>
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:jjpLf.2875$5M6.1878@newsread2.news.atl.earthl ink.net...[color=green]
>> Error 3197 will occur if you have another form open that displays the
>> same
>> record. Do you have another form open?
>>
>> An easier way to delete a record is to put the following code in the[/color]
> double[color=green]
>> click event of any field on your form:
>>
>> DoCmd.SetWarnings False
>> DoCmd.RunCommand acCmdDeleteRecord
>> DoCmd.SetWarnings True
>>
>> --
>> PC Datasheet
>> Your Resource For Help With Access, Excel And Word
>> Applications
>> Over 1125 users have come to me from the newsgroups requesting
>> help
>> resource@pcdatasheet.com
>>
>>
>> "DP" <DP@hotmail.com> wrote in message
>> news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...[color=darkred]
>> > hi,
>> >
>> > i've got a form, with a subform in it. i've got a delete button in the
>> > subform. the code i;ve got is;
>> >
>> > Private Sub cmdDeleteRecord_Click()
>> >
>> > msg = "Are you sure you want to delete this film rental record?"
>> > Style = vbYesNo + vbQuestion + vbDefaultButton2
>> >
>> > Response = MsgBox(msg, Style, "Film Rental Database")
>> > If Response = vbYes Then
>> >
>> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
> &[color=green][color=darkred]
>> > Me.FilmID
>> >
>> > Recordset.Delete
>> >
>> >
>> > Else
>> > MsgBox "You cancelled the delete operation"
>> >
>> > End If
>> >
>> > End Sub
>> >
>> > so when i lcick the delete button, i get the following error;
>> >
>> >
>> > runtime error 3197
>> >
>> > The Microsoft Jet Database Engine stopped becasue you and another user[/color][/color]
> are[color=green][color=darkred]
>> > attempting to change the same data at the same time.
>> >
>> >
>> > how can i overcome this error, as if i close the DB, and then open it
>> > again,
>> > it will delete the record, and update the correct field?? (currently i
>> > have
>> > to press the delete button twice to delete a record)
>> >
>> > thanx
>> >
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]


StopThisAdvertising
Guest
 
Posts: n/a
#6: Feb 24 '06

re: deleting records


Hmmm, is this the 'good' Martin or the 'bad' Martin answering here ??
Getting confused again these days ... (sorry)

Arno R

DP
Guest
 
Posts: n/a
#7: Feb 25 '06

re: deleting records


hi,

how come that works, if i assign it to a double click, but not work if i
assign it to a delete button?

I still get that error sometimes.

i'm trying to get it to work with the delete button, as it makes more sense.
(if u know wat i mean).
u dont normally double click to delete somthing.

dev


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:v6JLf.3131$S25.2446@newsread1.news.atl.earthl ink.net...[color=blue]
> If your subform is a continuous form, all the fields in any row comprise a
> record. You could put the code in the double click event of any field in a
> row and when you double clicked on that field, the entire record would be
> deleted. If your subform is a single form, all the fields you see in the
> subform at any point in time comprise a record. You could put the code in
> the double click event of any field in the subform and when you double
> clicked on that field, the entire record would be deleted.
>
> --
> PC Datasheet
> Your Resource For Help With Access, Excel And Word Applications
> Over 1125 users have come to me from the newsgroups requesting help
> resource@pcdatasheet.com
>
>
>
> "DP" <DP@hotmail.com> wrote in message
> news:g8GLf.35537$Fy4.23922@newsfe4-win.ntli.net...[color=green]
> > well yea, i have the main form open. it does not display the same[/color][/color]
record,[color=blue][color=green]
> > but it does display the same membershipID which is in the subform.[/color][/color]
(which[color=blue][color=green]
> > is
> > wat i;m trying to delete)
> >
> > how would the code u gave me help? as u would have to double click each
> > field wouldnt u?
> >
> > dev
> >
> > "PC Datasheet" <nospam@nospam.spam> wrote in message
> > news:jjpLf.2875$5M6.1878@newsread2.news.atl.earthl ink.net...[color=darkred]
> >> Error 3197 will occur if you have another form open that displays the
> >> same
> >> record. Do you have another form open?
> >>
> >> An easier way to delete a record is to put the following code in the[/color]
> > double[color=darkred]
> >> click event of any field on your form:
> >>
> >> DoCmd.SetWarnings False
> >> DoCmd.RunCommand acCmdDeleteRecord
> >> DoCmd.SetWarnings True
> >>
> >> --
> >> PC Datasheet
> >> Your Resource For Help With Access, Excel And Word
> >> Applications
> >> Over 1125 users have come to me from the newsgroups requesting
> >> help
> >> resource@pcdatasheet.com
> >>
> >>
> >> "DP" <DP@hotmail.com> wrote in message
> >> news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...
> >> > hi,
> >> >
> >> > i've got a form, with a subform in it. i've got a delete button in[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >> > subform. the code i;ve got is;
> >> >
> >> > Private Sub cmdDeleteRecord_Click()
> >> >
> >> > msg = "Are you sure you want to delete this film rental record?"
> >> > Style = vbYesNo + vbQuestion + vbDefaultButton2
> >> >
> >> > Response = MsgBox(msg, Style, "Film Rental Database")
> >> > If Response = vbYes Then
> >> >
> >> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID="[color=blue][color=green]
> > &[color=darkred]
> >> > Me.FilmID
> >> >
> >> > Recordset.Delete
> >> >
> >> >
> >> > Else
> >> > MsgBox "You cancelled the delete operation"
> >> >
> >> > End If
> >> >
> >> > End Sub
> >> >
> >> > so when i lcick the delete button, i get the following error;
> >> >
> >> >
> >> > runtime error 3197
> >> >
> >> > The Microsoft Jet Database Engine stopped becasue you and another[/color][/color][/color]
user[color=blue][color=green]
> > are[color=darkred]
> >> > attempting to change the same data at the same time.
> >> >
> >> >
> >> > how can i overcome this error, as if i close the DB, and then open it
> >> > again,
> >> > it will delete the record, and update the correct field?? (currently[/color][/color][/color]
i[color=blue][color=green][color=darkred]
> >> > have
> >> > to press the delete button twice to delete a record)
> >> >
> >> > thanx
> >> >
> >> >
> >> >
> >>
> >>[/color]
> >
> >[/color]
>
>[/color]


PC Datasheet
Guest
 
Posts: n/a
#8: Feb 25 '06

re: deleting records


Double-Clicking somewhere in a record is a standard way to delete a record!

The code will work fine if your subform is a single form. If your subform is
a continuous form, when you move from a record to your delete button, Access
does not know which record you want to delete.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
resource@pcdatasheet.com



"DP" <DP@hotmail.com> wrote in message
news:NlZLf.60051$mf2.54665@newsfe6-win.ntli.net...[color=blue]
> hi,
>
> how come that works, if i assign it to a double click, but not work if i
> assign it to a delete button?
>
> I still get that error sometimes.
>
> i'm trying to get it to work with the delete button, as it makes more
> sense.
> (if u know wat i mean).
> u dont normally double click to delete somthing.
>
> dev
>
>
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:v6JLf.3131$S25.2446@newsread1.news.atl.earthl ink.net...[color=green]
>> If your subform is a continuous form, all the fields in any row comprise
>> a
>> record. You could put the code in the double click event of any field in
>> a
>> row and when you double clicked on that field, the entire record would be
>> deleted. If your subform is a single form, all the fields you see in the
>> subform at any point in time comprise a record. You could put the code in
>> the double click event of any field in the subform and when you double
>> clicked on that field, the entire record would be deleted.
>>
>> --
>> PC Datasheet
>> Your Resource For Help With Access, Excel And Word
>> Applications
>> Over 1125 users have come to me from the newsgroups requesting
>> help
>> resource@pcdatasheet.com
>>
>>
>>
>> "DP" <DP@hotmail.com> wrote in message
>> news:g8GLf.35537$Fy4.23922@newsfe4-win.ntli.net...[color=darkred]
>> > well yea, i have the main form open. it does not display the same[/color][/color]
> record,[color=green][color=darkred]
>> > but it does display the same membershipID which is in the subform.[/color][/color]
> (which[color=green][color=darkred]
>> > is
>> > wat i;m trying to delete)
>> >
>> > how would the code u gave me help? as u would have to double click each
>> > field wouldnt u?
>> >
>> > dev
>> >
>> > "PC Datasheet" <nospam@nospam.spam> wrote in message
>> > news:jjpLf.2875$5M6.1878@newsread2.news.atl.earthl ink.net...
>> >> Error 3197 will occur if you have another form open that displays the
>> >> same
>> >> record. Do you have another form open?
>> >>
>> >> An easier way to delete a record is to put the following code in the
>> > double
>> >> click event of any field on your form:
>> >>
>> >> DoCmd.SetWarnings False
>> >> DoCmd.RunCommand acCmdDeleteRecord
>> >> DoCmd.SetWarnings True
>> >>
>> >> --
>> >> PC Datasheet
>> >> Your Resource For Help With Access, Excel And Word
>> >> Applications
>> >> Over 1125 users have come to me from the newsgroups requesting
>> >> help
>> >> resource@pcdatasheet.com
>> >>
>> >>
>> >> "DP" <DP@hotmail.com> wrote in message
>> >> news:eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net...
>> >> > hi,
>> >> >
>> >> > i've got a form, with a subform in it. i've got a delete button in[/color][/color]
> the[color=green][color=darkred]
>> >> > subform. the code i;ve got is;
>> >> >
>> >> > Private Sub cmdDeleteRecord_Click()
>> >> >
>> >> > msg = "Are you sure you want to delete this film rental record?"
>> >> > Style = vbYesNo + vbQuestion + vbDefaultButton2
>> >> >
>> >> > Response = MsgBox(msg, Style, "Film Rental Database")
>> >> > If Response = vbYes Then
>> >> >
>> >> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color]
> FilmID="[color=green][color=darkred]
>> > &
>> >> > Me.FilmID
>> >> >
>> >> > Recordset.Delete
>> >> >
>> >> >
>> >> > Else
>> >> > MsgBox "You cancelled the delete operation"
>> >> >
>> >> > End If
>> >> >
>> >> > End Sub
>> >> >
>> >> > so when i lcick the delete button, i get the following error;
>> >> >
>> >> >
>> >> > runtime error 3197
>> >> >
>> >> > The Microsoft Jet Database Engine stopped becasue you and another[/color][/color]
> user[color=green][color=darkred]
>> > are
>> >> > attempting to change the same data at the same time.
>> >> >
>> >> >
>> >> > how can i overcome this error, as if i close the DB, and then open
>> >> > it
>> >> > again,
>> >> > it will delete the record, and update the correct field?? (currently[/color][/color]
> i[color=green][color=darkred]
>> >> > have
>> >> > to press the delete button twice to delete a record)
>> >> >
>> >> > thanx
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]


RoyVidar
Guest
 
Posts: n/a
#9: Feb 25 '06

re: deleting records


DP wrote in message <eKnLf.15130$gB4.9220@newsfe4-gui.ntli.net> :[color=blue]
> hi,
>
> i've got a form, with a subform in it. i've got a delete button in the
> subform. the code i;ve got is;
>
> Private Sub cmdDeleteRecord_Click()
>
> msg = "Are you sure you want to delete this film rental record?"
> Style = vbYesNo + vbQuestion + vbDefaultButton2
>
> Response = MsgBox(msg, Style, "Film Rental Database")
> If Response = vbYes Then
>
> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
> Me.FilmID
>
> Recordset.Delete
>
>
> Else
> MsgBox "You cancelled the delete operation"
>
> End If
>
> End Sub
>
> so when i lcick the delete button, i get the following error;
>
>
> runtime error 3197
>
> The Microsoft Jet Database Engine stopped becasue you and another user are
> attempting to change the same data at the same time.
>
>
> how can i overcome this error, as if i close the DB, and then open it again,
> it will delete the record, and update the correct field?? (currently i have
> to press the delete button twice to delete a record)
>
> thanx[/color]

I think the errormessage might be due to you having unsaved changes in
the form, then attempting to alter the same data programatically.

Try one of the save options prior to running anything, for instance

if me.dirty then me.dirty = false

(for more info on these methods of saving, and a discussion of them,
though unrelated to this, have a read at the following article by Allen
Browne http://allenbrowne.com/bug-01.html)

I've never been a fan of deletes on a recordset, though it might
probably work

dim strSql as string
strSql = "delete from yourtable where fillmid = " & me!FilmID.value
currentdb.execute strSql, dbFailOnError

--
Roy-Vidar


RoyVidar
Guest
 
Posts: n/a
#10: Feb 25 '06

re: deleting records


Oh - and forgot, sorry - after deleting a record, you might want to do
a

me.requery

to freshen up the display.

--
Roy-Vidar


Bob Quintal
Guest
 
Posts: n/a
#11: Feb 25 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in
news:LD%Lf.3505$S25.2370@newsread1.news.atl.earthl ink.net:
[color=blue]
> Double-Clicking somewhere in a record is a standard way to
> delete a record!
>[/color]
Not in any serious database application it isn't.
[color=blue]
> The code will work fine if your subform is a single form. If
> your subform is a continuous form, when you move from a record
> to your delete button, Access does not know which record you
> want to delete.
>[/color]
Wrong. The code deletes the current record. If the button is on the
form's header or footer it works correctly on a continuous form. It
also works in a subform if the button is on the subform's header or
footer.

--
Bob Quintal

PA is y I've altered my email address.
Tim Marshall
Guest
 
Posts: n/a
#12: Feb 25 '06

re: deleting records


PC Datasheet wrote:
[color=blue]
> Double-Clicking somewhere in a record is a standard way to delete a record![/color]

Steve, if you meant right clicking, and bringing up a pop up menu with
an option to delete, I'd agree with you.

But double clicking to delete? Absolutely, positively not in any
serious database application I've ever used or developed in my
professional life.

Double clicking is easy for an inexperienced user to do accidentally.

This is very, very bad GUI advice. Double clicking is usually a means
to either bring up additional/ancilliary information in a pop up window
or drill down to other record displays in:

1) Computerized maintenance management systems,

2) Military ACIS

3) Point of sale systems

4) Inventory, including rental systems

5) Hazardous materials management

6) Significant incident reports

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
DP
Guest
 
Posts: n/a
#13: Feb 26 '06

re: deleting records


yea, thats wat i ment. i've never seen an app, that uses doube clicking to
delete a record.

anywayz i'm still working on this button, i'll let u know wat happens.

dev

"Tim Marshall" <TIMMY!@PurplePandaChasers.Moertherium> wrote in message
news:dtqh4h$6ne$1@coranto.ucs.mun.ca...[color=blue]
> PC Datasheet wrote:
>[color=green]
> > Double-Clicking somewhere in a record is a standard way to delete a[/color][/color]
record![color=blue]
>
> Steve, if you meant right clicking, and bringing up a pop up menu with
> an option to delete, I'd agree with you.
>
> But double clicking to delete? Absolutely, positively not in any
> serious database application I've ever used or developed in my
> professional life.
>
> Double clicking is easy for an inexperienced user to do accidentally.
>
> This is very, very bad GUI advice. Double clicking is usually a means
> to either bring up additional/ancilliary information in a pop up window
> or drill down to other record displays in:
>
> 1) Computerized maintenance management systems,
>
> 2) Military ACIS
>
> 3) Point of sale systems
>
> 4) Inventory, including rental systems
>
> 5) Hazardous materials management
>
> 6) Significant incident reports
>
> --
> Tim http://www.ucs.mun.ca/~tmarshal/
> ^o<
> /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
> /^^ "What's UP, Dittoooooo?" - Ditto[/color]


DP
Guest
 
Posts: n/a
#14: Feb 26 '06

re: deleting records


ok, so i've tried wat u have gave me, and it still is not working. i
understand the problem but dont have a clue wat else to do. i think i've
tried almost everything.

this is wat i've got; it might look confusing cos i been messing around with
it for a week now;

Private Sub cmdDeleteRecord_Click()

msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then
DeleteRecord

Else
MsgBox "You cancelled the delete operation"

End If

End Sub


================================================== ===========

Private Sub DeleteRecord()

DoCmd.SetWarnings False
'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
Me.FilmID
Update
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord

DoCmd.SetWarnings True
End Sub

================================================== ===================

Private Sub Update()
DoCmd.SetWarnings False
If FilmID = Null Then

MsgBox "Delete operation cannot be carried out"
'End If
Else
'DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
Me.FilmID
DoCmd.SetWarnings True
End If
End Sub
================================================== ===========

so, the code i've got works 'somtimes' as i get the error message described
before. (i've taken the double click event out, however that worked pretty
well.)

u know on the 'update' function, is it possible to check if the filmID is
null (empty) and then the sql update runs. (cos if i do it now, i just get
an error) i just wanted to create a little validation.

thanx

dev


"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.ccbc7d623d00696f.33955@yahoo.no...[color=blue]
> Oh - and forgot, sorry - after deleting a record, you might want to do
> a
>
> me.requery
>
> to freshen up the display.
>
> --
> Roy-Vidar
>
>[/color]


RoyVidar
Guest
 
Posts: n/a
#15: Feb 26 '06

re: deleting records


DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :[color=blue]
> ok, so i've tried wat u have gave me, and it still is not working. i
> understand the problem but dont have a clue wat else to do. i think i've
> tried almost everything.
>
> this is wat i've got; it might look confusing cos i been messing around with
> it for a week now;
>
> Private Sub cmdDeleteRecord_Click()
>
> msg = "Are you sure you want to delete this film rental record?"
> Style = vbYesNo + vbQuestion + vbDefaultButton2
>
> Response = MsgBox(msg, Style, "Film Rental Database")
> If Response = vbYes Then
> DeleteRecord
>
> Else
> MsgBox "You cancelled the delete operation"
>
> End If
>
> End Sub
>
>
> ================================================== ===========
>
> Private Sub DeleteRecord()
>
> DoCmd.SetWarnings False
> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
> Me.FilmID
> Update
> DoCmd.SetWarnings False
> DoCmd.RunCommand acCmdDeleteRecord
>
> DoCmd.SetWarnings True
> End Sub
>
> ================================================== ===================
>
> Private Sub Update()
> DoCmd.SetWarnings False
> If FilmID = Null Then
>
> MsgBox "Delete operation cannot be carried out"
> 'End If
> Else
> 'DoCmd.SetWarnings False
> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
> Me.FilmID
> DoCmd.SetWarnings True
> End If
> End Sub
> ================================================== ===========
>
> so, the code i've got works 'somtimes' as i get the error message described
> before. (i've taken the double click event out, however that worked pretty
> well.)
>
> u know on the 'update' function, is it possible to check if the filmID is
> null (empty) and then the sql update runs. (cos if i do it now, i just get
> an error) i just wanted to create a little validation.
>
> thanx
>
> dev
>
>
> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> news:mn.ccbc7d623d00696f.33955@yahoo.no...[color=green]
>> Oh - and forgot, sorry - after deleting a record, you might want to do
>> a
>>
>> me.requery
>>
>> to freshen up the display.
>>
>> --
>> Roy-Vidar[/color][/color]

I'm sorry, I can't see you've tried any of my suggestions from the code
you posted, so I don't know what to say, except to repeat

Do try
1 - save the record explicitly before doing anything else
2 - run a requery of the form after the process is finished

To test for contents in the control, you can for instance try

if len(me!FilmID.value & vbNullString)>0 then
' only if there's contents in the control, continue with routine


end if

The next question I would ask, is whether this table/record is open,
and
contains unsaved changes in another form. If so, try explicitly saving
the record there too, either before opening this form, or before trying
to update/save from this form.

--
Roy-Vidar


DP
Guest
 
Posts: n/a
#16: Feb 26 '06

re: deleting records


ok, tanx, i'll try it now.

sorry, i pasted the code from another program, which was working. i'm using
2 programs, which i have copied and pasted, so i do not loose any good code.
i have tried yor code, another another version.

tanx

dev

"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.d3017d62d1c469d0.33955@yahoo.no...[color=blue]
> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :[color=green]
> > ok, so i've tried wat u have gave me, and it still is not working. i
> > understand the problem but dont have a clue wat else to do. i think i've
> > tried almost everything.
> >
> > this is wat i've got; it might look confusing cos i been messing around[/color][/color]
with[color=blue][color=green]
> > it for a week now;
> >
> > Private Sub cmdDeleteRecord_Click()
> >
> > msg = "Are you sure you want to delete this film rental record?"
> > Style = vbYesNo + vbQuestion + vbDefaultButton2
> >
> > Response = MsgBox(msg, Style, "Film Rental Database")
> > If Response = vbYes Then
> > DeleteRecord
> >
> > Else
> > MsgBox "You cancelled the delete operation"
> >
> > End If
> >
> > End Sub
> >
> >
> > ================================================== ===========
> >
> > Private Sub DeleteRecord()
> >
> > DoCmd.SetWarnings False
> > 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> > Update
> > DoCmd.SetWarnings False
> > DoCmd.RunCommand acCmdDeleteRecord
> >
> > DoCmd.SetWarnings True
> > End Sub
> >
> > ================================================== ===================
> >
> > Private Sub Update()
> > DoCmd.SetWarnings False
> > If FilmID = Null Then
> >
> > MsgBox "Delete operation cannot be carried out"
> > 'End If
> > Else
> > 'DoCmd.SetWarnings False
> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> > DoCmd.SetWarnings True
> > End If
> > End Sub
> > ================================================== ===========
> >
> > so, the code i've got works 'somtimes' as i get the error message[/color][/color]
described[color=blue][color=green]
> > before. (i've taken the double click event out, however that worked[/color][/color]
pretty[color=blue][color=green]
> > well.)
> >
> > u know on the 'update' function, is it possible to check if the filmID[/color][/color]
is[color=blue][color=green]
> > null (empty) and then the sql update runs. (cos if i do it now, i just[/color][/color]
get[color=blue][color=green]
> > an error) i just wanted to create a little validation.
> >
> > thanx
> >
> > dev
> >
> >
> > "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> > news:mn.ccbc7d623d00696f.33955@yahoo.no...[color=darkred]
> >> Oh - and forgot, sorry - after deleting a record, you might want to do
> >> a
> >>
> >> me.requery
> >>
> >> to freshen up the display.
> >>
> >> --
> >> Roy-Vidar[/color][/color]
>
> I'm sorry, I can't see you've tried any of my suggestions from the code
> you posted, so I don't know what to say, except to repeat
>
> Do try
> 1 - save the record explicitly before doing anything else
> 2 - run a requery of the form after the process is finished
>
> To test for contents in the control, you can for instance try
>
> if len(me!FilmID.value & vbNullString)>0 then
> ' only if there's contents in the control, continue with routine
>
>
> end if
>
> The next question I would ask, is whether this table/record is open,
> and
> contains unsaved changes in another form. If so, try explicitly saving
> the record there too, either before opening this form, or before trying
> to update/save from this form.
>
> --
> Roy-Vidar
>
>[/color]


PC Datasheet
Guest
 
Posts: n/a
#17: Feb 26 '06

re: deleting records


There's nothing wrong with double clicking in a record! In fact with using
double clicking the user knows explicitly which record he is about to
delete. In my opinion, a button on the main form to delete a record in the
subform is confusing. One would expect a button on the main form to do
something on the main form. A button on the subform can not be lined up with
buttons on the main form and so gives a less neat appearance to the overall
form. A delete button is less efficient. The user must first somehow go to
the record he wants to delete and then go to the delete button. This takes
two movements. Along the same lines, users who like to do everything with
the keyboard, will not prefer a delete button. It forces them to use the
mouse. As far as an inexperienced user accidently double clicking on a
record, he does not want to delete, he can more easily do the same thing by
being on the wrong record and then clicking a delete button. And so what if
a user double clicks on the wrong record; you have appropriate code to warn
the user when deleting a record:


Dim Msg As String
Dim Style as String
msg = "Are you sure you want to delete this film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2

Response = MsgBox(msg, Style, "Film Rental Database")
If Response = vbYes Then

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True

Else
MsgBox "You cancelled the delete operation"

End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
resource@pcdatasheet.com



"DP" <DP@hotmail.com> wrote in message
news:H_fMf.52436$494.40876@newsfe2-gui.ntli.net...[color=blue]
> yea, thats wat i ment. i've never seen an app, that uses doube clicking to
> delete a record.
>
> anywayz i'm still working on this button, i'll let u know wat happens.
>
> dev
>
> "Tim Marshall" <TIMMY!@PurplePandaChasers.Moertherium> wrote in message
> news:dtqh4h$6ne$1@coranto.ucs.mun.ca...[color=green]
>> PC Datasheet wrote:
>>[color=darkred]
>> > Double-Clicking somewhere in a record is a standard way to delete a[/color][/color]
> record![color=green]
>>
>> Steve, if you meant right clicking, and bringing up a pop up menu with
>> an option to delete, I'd agree with you.
>>
>> But double clicking to delete? Absolutely, positively not in any
>> serious database application I've ever used or developed in my
>> professional life.
>>
>> Double clicking is easy for an inexperienced user to do accidentally.
>>
>> This is very, very bad GUI advice. Double clicking is usually a means
>> to either bring up additional/ancilliary information in a pop up window
>> or drill down to other record displays in:
>>
>> 1) Computerized maintenance management systems,
>>
>> 2) Military ACIS
>>
>> 3) Point of sale systems
>>
>> 4) Inventory, including rental systems
>>
>> 5) Hazardous materials management
>>
>> 6) Significant incident reports
>>
>> --
>> Tim http://www.ucs.mun.ca/~tmarshal/
>> ^o<
>> /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
>> /^^ "What's UP, Dittoooooo?" - Ditto[/color]
>
>[/color]


DP
Guest
 
Posts: n/a
#18: Feb 26 '06

re: deleting records


wat if i wanted it to display a message when there is NO content in the
field?

thats wat u gave me;

if len(me!FilmID.value & vbNullString)>0 then


cos i have to use an update query to update another table, and i wanted to
create a little validation. (and to stop an error popping up when there is
no record active.)

(so i basically want it to display an error, when there is nothing to
delete).

thanx

dev

"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.d3017d62d1c469d0.33955@yahoo.no...[color=blue]
> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :[color=green]
> > ok, so i've tried wat u have gave me, and it still is not working. i
> > understand the problem but dont have a clue wat else to do. i think i've
> > tried almost everything.
> >
> > this is wat i've got; it might look confusing cos i been messing around[/color][/color]
with[color=blue][color=green]
> > it for a week now;
> >
> > Private Sub cmdDeleteRecord_Click()
> >
> > msg = "Are you sure you want to delete this film rental record?"
> > Style = vbYesNo + vbQuestion + vbDefaultButton2
> >
> > Response = MsgBox(msg, Style, "Film Rental Database")
> > If Response = vbYes Then
> > DeleteRecord
> >
> > Else
> > MsgBox "You cancelled the delete operation"
> >
> > End If
> >
> > End Sub
> >
> >
> > ================================================== ===========
> >
> > Private Sub DeleteRecord()
> >
> > DoCmd.SetWarnings False
> > 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> > Update
> > DoCmd.SetWarnings False
> > DoCmd.RunCommand acCmdDeleteRecord
> >
> > DoCmd.SetWarnings True
> > End Sub
> >
> > ================================================== ===================
> >
> > Private Sub Update()
> > DoCmd.SetWarnings False
> > If FilmID = Null Then
> >
> > MsgBox "Delete operation cannot be carried out"
> > 'End If
> > Else
> > 'DoCmd.SetWarnings False
> > DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="[/color][/color]
&[color=blue][color=green]
> > Me.FilmID
> > DoCmd.SetWarnings True
> > End If
> > End Sub
> > ================================================== ===========
> >
> > so, the code i've got works 'somtimes' as i get the error message[/color][/color]
described[color=blue][color=green]
> > before. (i've taken the double click event out, however that worked[/color][/color]
pretty[color=blue][color=green]
> > well.)
> >
> > u know on the 'update' function, is it possible to check if the filmID[/color][/color]
is[color=blue][color=green]
> > null (empty) and then the sql update runs. (cos if i do it now, i just[/color][/color]
get[color=blue][color=green]
> > an error) i just wanted to create a little validation.
> >
> > thanx
> >
> > dev
> >
> >
> > "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> > news:mn.ccbc7d623d00696f.33955@yahoo.no...[color=darkred]
> >> Oh - and forgot, sorry - after deleting a record, you might want to do
> >> a
> >>
> >> me.requery
> >>
> >> to freshen up the display.
> >>
> >> --
> >> Roy-Vidar[/color][/color]
>
> I'm sorry, I can't see you've tried any of my suggestions from the code
> you posted, so I don't know what to say, except to repeat
>
> Do try
> 1 - save the record explicitly before doing anything else
> 2 - run a requery of the form after the process is finished
>
> To test for contents in the control, you can for instance try
>
> if len(me!FilmID.value & vbNullString)>0 then
> ' only if there's contents in the control, continue with routine
>
>
> end if
>
> The next question I would ask, is whether this table/record is open,
> and
> contains unsaved changes in another form. If so, try explicitly saving
> the record there too, either before opening this form, or before trying
> to update/save from this form.
>
> --
> Roy-Vidar
>
>[/color]


John Marshall, MVP
Guest
 
Posts: n/a
#19: Feb 26 '06

re: deleting records


Your logic is unbelievable. Double clicking to delete a record? Most normal
users would expect that the record would be selected or opened in a new
window.

So users do not want to use a delete button because it involves using a
mouse? So what are you double clicking?

You actually get people to pay you for this type of logic? Do any come back?

John... Visio MVP


RoyVidar
Guest
 
Posts: n/a
#20: Feb 26 '06

re: deleting records


DP wrote in message <xnmMf.60678$mf2.43175@newsfe6-win.ntli.net> :[color=blue]
> wat if i wanted it to display a message when there is NO content in the
> field?
>
> thats wat u gave me;
>
> if len(me!FilmID.value & vbNullString)>0 then
>
>
> cos i have to use an update query to update another table, and i wanted to
> create a little validation. (and to stop an error popping up when there is
> no record active.)
>
> (so i basically want it to display an error, when there is nothing to
> delete).
>
> thanx
>
> dev
>
> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> news:mn.d3017d62d1c469d0.33955@yahoo.no...[color=green]
>> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :[color=darkred]
>>> ok, so i've tried wat u have gave me, and it still is not working. i
>>> understand the problem but dont have a clue wat else to do. i think i've
>>> tried almost everything.
>>>
>>> this is wat i've got; it might look confusing cos i been messing around
>>> with it for a week now;
>>>
>>> Private Sub cmdDeleteRecord_Click()
>>>
>>> msg = "Are you sure you want to delete this film rental record?"
>>> Style = vbYesNo + vbQuestion + vbDefaultButton2
>>>
>>> Response = MsgBox(msg, Style, "Film Rental Database")
>>> If Response = vbYes Then
>>> DeleteRecord
>>>
>>> Else
>>> MsgBox "You cancelled the delete operation"
>>>
>>> End If
>>>
>>> End Sub
>>>
>>>
>>> ================================================== ===========
>>>
>>> Private Sub DeleteRecord()
>>>
>>> DoCmd.SetWarnings False
>>> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
>>> Me.FilmID
>>> Update
>>> DoCmd.SetWarnings False
>>> DoCmd.RunCommand acCmdDeleteRecord
>>>
>>> DoCmd.SetWarnings True
>>> End Sub
>>>
>>> ================================================== ===================
>>>
>>> Private Sub Update()
>>> DoCmd.SetWarnings False
>>> If FilmID = Null Then
>>>
>>> MsgBox "Delete operation cannot be carried out"
>>> 'End If
>>> Else
>>> 'DoCmd.SetWarnings False
>>> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
>>> Me.FilmID
>>> DoCmd.SetWarnings True
>>> End If
>>> End Sub
>>> ================================================== ===========
>>>
>>> so, the code i've got works 'somtimes' as i get the error message described
>>> before. (i've taken the double click event out, however that worked pretty
>>> well.)
>>>
>>> u know on the 'update' function, is it possible to check if the filmID is
>>> null (empty) and then the sql update runs. (cos if i do it now, i just get
>>> an error) i just wanted to create a little validation.
>>>
>>> thanx
>>>
>>> dev
>>>
>>>
>>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
>>> news:mn.ccbc7d623d00696f.33955@yahoo.no...
>>>> Oh - and forgot, sorry - after deleting a record, you might want to do
>>>> a
>>>>
>>>> me.requery
>>>>
>>>> to freshen up the display.
>>>>
>>>> --
>>>> Roy-Vidar[/color]
>>
>> I'm sorry, I can't see you've tried any of my suggestions from the code
>> you posted, so I don't know what to say, except to repeat
>>
>> Do try
>> 1 - save the record explicitly before doing anything else
>> 2 - run a requery of the form after the process is finished
>>
>> To test for contents in the control, you can for instance try
>>
>> if len(me!FilmID.value & vbNullString)>0 then
>> ' only if there's contents in the control, continue with routine
>>
>>
>> end if
>>
>> The next question I would ask, is whether this table/record is open,
>> and
>> contains unsaved changes in another form. If so, try explicitly saving
>> the record there too, either before opening this form, or before trying
>> to update/save from this form.
>>
>> --
>> Roy-Vidar[/color][/color]

Look at the Else clause of the If-Then-Else construct

If <some condition> Then
' perform some code (the updating stuff?)
Else
' perform some other code (perhaps a message box)
End If

It would be interesting to know whether the previous suggestions worked
with regards to the initial errors.

--
Roy-Vidar


PC Datasheet
Guest
 
Posts: n/a
#21: Feb 26 '06

re: deleting records


Why don't you go and kiss Arno's A&$*##!!! You're an A&$*##!!! who makes no
contribution to this newsgroup and an embarassment to what MVP is suppose to
stand for.



"John Marshall, MVP" <lancucki@stonehenge.ca> wrote in message
news:3ZqdnTxvBuN-n5_ZRVn-tQ@magma.ca...[color=blue]
> Your logic is unbelievable. Double clicking to delete a record? Most
> normal users would expect that the record would be selected or opened in a
> new window.
>
> So users do not want to use a delete button because it involves using a
> mouse? So what are you double clicking?
>
> You actually get people to pay you for this type of logic? Do any come
> back?
>
> John... Visio MVP
>[/color]


Arno R
Guest
 
Posts: n/a
#22: Feb 26 '06

re: deleting records



"PC Datasheet" <nospam@nospam.spam> schreef in bericht news:LD%Lf.3505$S25.2370@newsread1.news.atl.earthl ink.net...
[color=blue]
> Double-Clicking somewhere in a record is a standard way to delete a record![/color]

This is (again) sheer, utter nonsense !!

Arno R
Larry Linson
Guest
 
Posts: n/a
#23: Feb 26 '06

re: deleting records


"PC Datasheet" wrote
[color=blue]
> Why don't you go and kiss Arno's A&$*##!!!
> You're an A&$*##!!! who makes no
> contribution to this newsgroup and an embarass-
> ment to what MVP is suppose to
> stand for.[/color]

<SARCASM>How nice that you can maintain your cool when all about you are
losing theirs. Nice work, Steve. </SARCASM>

Double-clicking for delete would be a very unusual user interface practice.

There's an old axiom, "When you find you are digging yourself into a deeper
hole, stop digging." Continuing to try to justify bad advice that you have
given is definitely in the category of "digging yourself into a deeper
hole."

And, before you bother to bring up your invalid claim again, "NO, I would
never seek subcontract work from someone who has confessed that he stiffs
his subcontractors. Never. I may not be the brightest bulb in the
chandelier, but I am bright enough to know not to work for people who don't
pay what they owe."

Larry Linson


PC Datasheet
Guest
 
Posts: n/a
#24: Feb 26 '06

re: deleting records


Why don't you go and kiss John Marshall's A&$*##!!! You're an A&$*##!!! who
makes no
contribution to this newsgroup.



"Arno R" <arraNOcomSPAM@tiscali.nl> wrote in message
news:44022a25$0$2031$ba620dc5@text.nova.planet.nl. ..

"PC Datasheet" <nospam@nospam.spam> schreef in bericht
news:LD%Lf.3505$S25.2370@newsread1.news.atl.earthl ink.net...
[color=blue]
> Double-Clicking somewhere in a record is a standard way to delete a
> record![/color]

This is (again) sheer, utter nonsense !!

Arno R


Tim Marshall
Guest
 
Posts: n/a
#25: Feb 27 '06

re: deleting records


PC Datasheet wrote:[color=blue]
> Why don't you go and kiss[/color]

Seriously, Steve, it may be there are other issues that are intensifying
this, but double clicking to delete is really a very bad GUI feature in
that it is totally unexpected behaviour. It is indeed a pretty
universal windows function that double clicking a record drills down
somehow, rather than deleting.

I note your string for your msgbox uses vbyesno. One frequent issue
with users is the mind numb mode - double clicking a record is often an
accidental occurance and many people when in mind numb mode will simply
press the enter button without reading the message box. I would suggest
a system whereby double clicking is a delete action has not undergone
very much in the way of user trials.

Also, I notice you're using setwarnings which is not an effective way to
run an action statement. Use the execute method with dbfailonerror.
That way if for some reason there's a flaw in your sql, setwarnings is
not turned off permanently.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
PC Datasheet
Guest
 
Posts: n/a
#26: Feb 27 '06

re: deleting records


Tim,

I compliment you on the polite response!

We have a difference of opinion on how to delete a record and it may come
from the difference of the applications we write. Both work so it's like
most things in Access there are multiple ways to do a task. The OP has seen
the arguments and he can decide what he wants to do.

I do agree with you on using the execute method with dbfailonerror. Most of
the time I use that. Sometimes I forget and I revert to past practice
because I used it so much in the past. Right or wrong, I believe you will
see the SetWarnings recommendation much more in the newsgroup.

Steve


"Tim Marshall" <TIMMY!@PurplePandaChasers.Moertherium> wrote in message
news:dttcef$db1$1@coranto.ucs.mun.ca...[color=blue]
> PC Datasheet wrote:[color=green]
>> Why don't you go and kiss[/color]
>
> Seriously, Steve, it may be there are other issues that are intensifying
> this, but double clicking to delete is really a very bad GUI feature in
> that it is totally unexpected behaviour. It is indeed a pretty universal
> windows function that double clicking a record drills down somehow, rather
> than deleting.
>
> I note your string for your msgbox uses vbyesno. One frequent issue with
> users is the mind numb mode - double clicking a record is often an
> accidental occurance and many people when in mind numb mode will simply
> press the enter button without reading the message box. I would suggest a
> system whereby double clicking is a delete action has not undergone very
> much in the way of user trials.
>
> Also, I notice you're using setwarnings which is not an effective way to
> run an action statement. Use the execute method with dbfailonerror. That
> way if for some reason there's a flaw in your sql, setwarnings is not
> turned off permanently.
> --
> Tim http://www.ucs.mun.ca/~tmarshal/
> ^o<
> /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
> /^^ "What's UP, Dittoooooo?" - Ditto[/color]


John Marshall, MVP
Guest
 
Posts: n/a
#27: Feb 27 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:IrsMf.3727$F56.3375@newsread3.news.atl.earthl ink.net...
[color=blue]
> I compliment you on the polite response![/color]

No need for a compliment. Tim is just behaving as a normal member of these
newsgroups. You on
the other hand have a lot to apologize for. Your behaviour is (and has been)
very juvenile.
[color=blue]
> We have a difference of opinion on how to delete a record and it may come
> from the difference of the applications we write. Both work so it's like
> most things in Access there are multiple ways to do a task.[/color]

It's not a matter of opinion, your suggestion like your behaviour is just
wrong.
[color=blue]
> Steve
>[color=green]
>> PC Datasheet wrote:[color=darkred]
>>> Why don't you go and kiss[/color][/color][/color]


--
John... Visio MVP


Larry Linson
Guest
 
Posts: n/a
#28: Feb 27 '06

re: deleting records


"PC Datasheet" wrote
[color=blue]
> You're an <expletive deleted> who makes no contribution to this newsgroup.[/color]

Arno, if Steve were correct (which I know he is not, as I have read some of
your very real contributions to this newsgroup), it would at least mean you
did not mislead by giving potentially harmful advice, wouldn't it?

Larry


PC Datasheet
Guest
 
Posts: n/a
#29: Feb 27 '06

re: deleting records


Why don't you go and kiss Arno's A&$*## for a second time!!! You're an
A&$*##!!! who makes no
contribution to this newsgroup and an embarassment to what MVP is suppose to
stand for.



"John Marshall, MVP" <lancucki@stonehenge.ca> wrote in message
news:SqSdnYVG4aiR-J_ZRVn-tQ@magma.ca...[color=blue]
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:IrsMf.3727$F56.3375@newsread3.news.atl.earthl ink.net...
>[color=green]
>> I compliment you on the polite response![/color]
>
> No need for a compliment. Tim is just behaving as a normal member of these
> newsgroups. You on
> the other hand have a lot to apologize for. Your behaviour is (and has
> been) very juvenile.
>[color=green]
>> We have a difference of opinion on how to delete a record and it may come
>> from the difference of the applications we write. Both work so it's like
>> most things in Access there are multiple ways to do a task.[/color]
>
> It's not a matter of opinion, your suggestion like your behaviour is just
> wrong.
>[color=green]
>> Steve
>>[color=darkred]
>>> PC Datasheet wrote:
>>>> Why don't you go and kiss[/color][/color]
>
>
> --
> John... Visio MVP
>[/color]


DP
Guest
 
Posts: n/a
#30: Feb 27 '06

re: deleting records


sorry.
i've been trying them, but with no success. i've tried saving as u
mentioned. i saved after an update, after the record was changed, etc... i
even tried saving the main form and subform. (when dirty, on load, etc...)
i've tried the requery as well, but none of them work. it still comes out
with that same error.

i have not tried it in single form mode, as i need it in continous.

i dont know wat else to do, as the error only comes after u try deleting a
record straight away. If u delete it after a min, or after restarting, the
error does not arise. however, thancx for all the help, i know u have not
started arguing with other people. lol. (somone actually mentioed deleting a
record through double clicking, which i dont want to do, as it does not feel
correct, if u know wat i mean). thats bad HCI!!

i'll try the other bit of code u gave me now....

thanx

dev

"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.d50c7d629e6d7b13.33955@yahoo.no...[color=blue]
> DP wrote in message <xnmMf.60678$mf2.43175@newsfe6-win.ntli.net> :[color=green]
> > wat if i wanted it to display a message when there is NO content in the
> > field?
> >
> > thats wat u gave me;
> >
> > if len(me!FilmID.value & vbNullString)>0 then
> >
> >
> > cos i have to use an update query to update another table, and i wanted[/color][/color]
to[color=blue][color=green]
> > create a little validation. (and to stop an error popping up when there[/color][/color]
is[color=blue][color=green]
> > no record active.)
> >
> > (so i basically want it to display an error, when there is nothing to
> > delete).
> >
> > thanx
> >
> > dev
> >
> > "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> > news:mn.d3017d62d1c469d0.33955@yahoo.no...[color=darkred]
> >> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :
> >>> ok, so i've tried wat u have gave me, and it still is not working. i
> >>> understand the problem but dont have a clue wat else to do. i think[/color][/color][/color]
i've[color=blue][color=green][color=darkred]
> >>> tried almost everything.
> >>>
> >>> this is wat i've got; it might look confusing cos i been messing[/color][/color][/color]
around[color=blue][color=green][color=darkred]
> >>> with it for a week now;
> >>>
> >>> Private Sub cmdDeleteRecord_Click()
> >>>
> >>> msg = "Are you sure you want to delete this film rental record?"
> >>> Style = vbYesNo + vbQuestion + vbDefaultButton2
> >>>
> >>> Response = MsgBox(msg, Style, "Film Rental Database")
> >>> If Response = vbYes Then
> >>> DeleteRecord
> >>>
> >>> Else
> >>> MsgBox "You cancelled the delete operation"
> >>>
> >>> End If
> >>>
> >>> End Sub
> >>>
> >>>
> >>> ================================================== ===========
> >>>
> >>> Private Sub DeleteRecord()
> >>>
> >>> DoCmd.SetWarnings False
> >>> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID=" &[color=blue][color=green][color=darkred]
> >>> Me.FilmID
> >>> Update
> >>> DoCmd.SetWarnings False
> >>> DoCmd.RunCommand acCmdDeleteRecord
> >>>
> >>> DoCmd.SetWarnings True
> >>> End Sub
> >>>
> >>> ================================================== ===================
> >>>
> >>> Private Sub Update()
> >>> DoCmd.SetWarnings False
> >>> If FilmID = Null Then
> >>>
> >>> MsgBox "Delete operation cannot be carried out"
> >>> 'End If
> >>> Else
> >>> 'DoCmd.SetWarnings False
> >>> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID=" &[color=blue][color=green][color=darkred]
> >>> Me.FilmID
> >>> DoCmd.SetWarnings True
> >>> End If
> >>> End Sub
> >>> ================================================== ===========
> >>>
> >>> so, the code i've got works 'somtimes' as i get the error message[/color][/color][/color]
described[color=blue][color=green][color=darkred]
> >>> before. (i've taken the double click event out, however that worked[/color][/color][/color]
pretty[color=blue][color=green][color=darkred]
> >>> well.)
> >>>
> >>> u know on the 'update' function, is it possible to check if the filmID[/color][/color][/color]
is[color=blue][color=green][color=darkred]
> >>> null (empty) and then the sql update runs. (cos if i do it now, i just[/color][/color][/color]
get[color=blue][color=green][color=darkred]
> >>> an error) i just wanted to create a little validation.
> >>>
> >>> thanx
> >>>
> >>> dev
> >>>
> >>>
> >>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> >>> news:mn.ccbc7d623d00696f.33955@yahoo.no...
> >>>> Oh - and forgot, sorry - after deleting a record, you might want to[/color][/color][/color]
do[color=blue][color=green][color=darkred]
> >>>> a
> >>>>
> >>>> me.requery
> >>>>
> >>>> to freshen up the display.
> >>>>
> >>>> --
> >>>> Roy-Vidar
> >>
> >> I'm sorry, I can't see you've tried any of my suggestions from the code
> >> you posted, so I don't know what to say, except to repeat
> >>
> >> Do try
> >> 1 - save the record explicitly before doing anything else
> >> 2 - run a requery of the form after the process is finished
> >>
> >> To test for contents in the control, you can for instance try
> >>
> >> if len(me!FilmID.value & vbNullString)>0 then
> >> ' only if there's contents in the control, continue with routine
> >>
> >>
> >> end if
> >>
> >> The next question I would ask, is whether this table/record is open,
> >> and
> >> contains unsaved changes in another form. If so, try explicitly saving
> >> the record there too, either before opening this form, or before trying
> >> to update/save from this form.
> >>
> >> --
> >> Roy-Vidar[/color][/color]
>
> Look at the Else clause of the If-Then-Else construct
>
> If <some condition> Then
> ' perform some code (the updating stuff?)
> Else
> ' perform some other code (perhaps a message box)
> End If
>
> It would be interesting to know whether the previous suggestions worked
> with regards to the initial errors.
>
> --
> Roy-Vidar
>
>[/color]


DP
Guest
 
Posts: n/a
#31: Feb 27 '06

re: deleting records


sorry, wats the piece of code, to see if there is an empty string in the
field. i cant find it now.


thanx

dev

"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.d50c7d629e6d7b13.33955@yahoo.no...[color=blue]
> DP wrote in message <xnmMf.60678$mf2.43175@newsfe6-win.ntli.net> :[color=green]
> > wat if i wanted it to display a message when there is NO content in the
> > field?
> >
> > thats wat u gave me;
> >
> > if len(me!FilmID.value & vbNullString)>0 then
> >
> >
> > cos i have to use an update query to update another table, and i wanted[/color][/color]
to[color=blue][color=green]
> > create a little validation. (and to stop an error popping up when there[/color][/color]
is[color=blue][color=green]
> > no record active.)
> >
> > (so i basically want it to display an error, when there is nothing to
> > delete).
> >
> > thanx
> >
> > dev
> >
> > "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> > news:mn.d3017d62d1c469d0.33955@yahoo.no...[color=darkred]
> >> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :
> >>> ok, so i've tried wat u have gave me, and it still is not working. i
> >>> understand the problem but dont have a clue wat else to do. i think[/color][/color][/color]
i've[color=blue][color=green][color=darkred]
> >>> tried almost everything.
> >>>
> >>> this is wat i've got; it might look confusing cos i been messing[/color][/color][/color]
around[color=blue][color=green][color=darkred]
> >>> with it for a week now;
> >>>
> >>> Private Sub cmdDeleteRecord_Click()
> >>>
> >>> msg = "Are you sure you want to delete this film rental record?"
> >>> Style = vbYesNo + vbQuestion + vbDefaultButton2
> >>>
> >>> Response = MsgBox(msg, Style, "Film Rental Database")
> >>> If Response = vbYes Then
> >>> DeleteRecord
> >>>
> >>> Else
> >>> MsgBox "You cancelled the delete operation"
> >>>
> >>> End If
> >>>
> >>> End Sub
> >>>
> >>>
> >>> ================================================== ===========
> >>>
> >>> Private Sub DeleteRecord()
> >>>
> >>> DoCmd.SetWarnings False
> >>> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID=" &[color=blue][color=green][color=darkred]
> >>> Me.FilmID
> >>> Update
> >>> DoCmd.SetWarnings False
> >>> DoCmd.RunCommand acCmdDeleteRecord
> >>>
> >>> DoCmd.SetWarnings True
> >>> End Sub
> >>>
> >>> ================================================== ===================
> >>>
> >>> Private Sub Update()
> >>> DoCmd.SetWarnings False
> >>> If FilmID = Null Then
> >>>
> >>> MsgBox "Delete operation cannot be carried out"
> >>> 'End If
> >>> Else
> >>> 'DoCmd.SetWarnings False
> >>> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID=" &[color=blue][color=green][color=darkred]
> >>> Me.FilmID
> >>> DoCmd.SetWarnings True
> >>> End If
> >>> End Sub
> >>> ================================================== ===========
> >>>
> >>> so, the code i've got works 'somtimes' as i get the error message[/color][/color][/color]
described[color=blue][color=green][color=darkred]
> >>> before. (i've taken the double click event out, however that worked[/color][/color][/color]
pretty[color=blue][color=green][color=darkred]
> >>> well.)
> >>>
> >>> u know on the 'update' function, is it possible to check if the filmID[/color][/color][/color]
is[color=blue][color=green][color=darkred]
> >>> null (empty) and then the sql update runs. (cos if i do it now, i just[/color][/color][/color]
get[color=blue][color=green][color=darkred]
> >>> an error) i just wanted to create a little validation.
> >>>
> >>> thanx
> >>>
> >>> dev
> >>>
> >>>
> >>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> >>> news:mn.ccbc7d623d00696f.33955@yahoo.no...
> >>>> Oh - and forgot, sorry - after deleting a record, you might want to[/color][/color][/color]
do[color=blue][color=green][color=darkred]
> >>>> a
> >>>>
> >>>> me.requery
> >>>>
> >>>> to freshen up the display.
> >>>>
> >>>> --
> >>>> Roy-Vidar
> >>
> >> I'm sorry, I can't see you've tried any of my suggestions from the code
> >> you posted, so I don't know what to say, except to repeat
> >>
> >> Do try
> >> 1 - save the record explicitly before doing anything else
> >> 2 - run a requery of the form after the process is finished
> >>
> >> To test for contents in the control, you can for instance try
> >>
> >> if len(me!FilmID.value & vbNullString)>0 then
> >> ' only if there's contents in the control, continue with routine
> >>
> >>
> >> end if
> >>
> >> The next question I would ask, is whether this table/record is open,
> >> and
> >> contains unsaved changes in another form. If so, try explicitly saving
> >> the record there too, either before opening this form, or before trying
> >> to update/save from this form.
> >>
> >> --
> >> Roy-Vidar[/color][/color]
>
> Look at the Else clause of the If-Then-Else construct
>
> If <some condition> Then
> ' perform some code (the updating stuff?)
> Else
> ' perform some other code (perhaps a message box)
> End If
>
> It would be interesting to know whether the previous suggestions worked
> with regards to the initial errors.
>
> --
> Roy-Vidar
>
>[/color]


Arno R
Guest
 
Posts: n/a
#32: Feb 27 '06

re: deleting records



"PC Datasheet" <nospam@nospam.spam> schreef in bericht news:w5rMf.4632$5M6.1741@newsread2.news.atl.earthl ink.net...[color=blue]
> Why don't you go and kiss John Marshall's A&$*##!!! You're an A&$*##!!! who
> makes no
> contribution to this newsgroup.[/color]

Why don't you stop 'contributing' lies, name-calling and sheer utter nonsense here?

Why don't you stop posting your false claim that you are a 'resource'?
Why don't you stop posting your idiotic claim 1100+ users requested your 'help'?

Arno R

RoyVidar
Guest
 
Posts: n/a
#33: Feb 27 '06

re: deleting records


DP wrote in message <L3AMf.36273$Fy4.27110@newsfe4-win.ntli.net> :[color=blue]
> sorry.
> i've been trying them, but with no success. i've tried saving as u
> mentioned. i saved after an update, after the record was changed, etc... i
> even tried saving the main form and subform. (when dirty, on load, etc...)
> i've tried the requery as well, but none of them work. it still comes out
> with that same error.
>
> i have not tried it in single form mode, as i need it in continous.
>
> i dont know wat else to do, as the error only comes after u try deleting a
> record straight away. If u delete it after a min, or after restarting, the
> error does not arise. however, thancx for all the help, i know u have not
> started arguing with other people. lol. (somone actually mentioed deleting a
> record through double clicking, which i dont want to do, as it does not feel
> correct, if u know wat i mean). thats bad HCI!!
>
> i'll try the other bit of code u gave me now....
>
> thanx
>
> dev
>
> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> news:mn.d50c7d629e6d7b13.33955@yahoo.no...[color=green]
>> DP wrote in message <xnmMf.60678$mf2.43175@newsfe6-win.ntli.net> :[color=darkred]
>>> wat if i wanted it to display a message when there is NO content in the
>>> field?
>>>
>>> thats wat u gave me;
>>>
>>> if len(me!FilmID.value & vbNullString)>0 then
>>>
>>>
>>> cos i have to use an update query to update another table, and i wanted to
>>> create a little validation. (and to stop an error popping up when there is
>>> no record active.)
>>>
>>> (so i basically want it to display an error, when there is nothing to
>>> delete).
>>>
>>> thanx
>>>
>>> dev
>>>
>>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
>>> news:mn.d3017d62d1c469d0.33955@yahoo.no...
>>>> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :
>>>>> ok, so i've tried wat u have gave me, and it still is not working. i
>>>>> understand the problem but dont have a clue wat else to do. i think i've
>>>>> tried almost everything.
>>>>>
>>>>> this is wat i've got; it might look confusing cos i been messing around
>>>>> with it for a week now;
>>>>>
>>>>> Private Sub cmdDeleteRecord_Click()
>>>>>
>>>>> msg = "Are you sure you want to delete this film rental record?"
>>>>> Style = vbYesNo + vbQuestion + vbDefaultButton2
>>>>>
>>>>> Response = MsgBox(msg, Style, "Film Rental Database")
>>>>> If Response = vbYes Then
>>>>> DeleteRecord
>>>>>
>>>>> Else
>>>>> MsgBox "You cancelled the delete operation"
>>>>>
>>>>> End If
>>>>>
>>>>> End Sub
>>>>>
>>>>>
>>>>> ================================================== ===========
>>>>>
>>>>> Private Sub DeleteRecord()
>>>>>
>>>>> DoCmd.SetWarnings False
>>>>> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID="
>>>>> & Me.FilmID
>>>>> Update
>>>>> DoCmd.SetWarnings False
>>>>> DoCmd.RunCommand acCmdDeleteRecord
>>>>>
>>>>> DoCmd.SetWarnings True
>>>>> End Sub
>>>>>
>>>>> ================================================== ===================
>>>>>
>>>>> Private Sub Update()
>>>>> DoCmd.SetWarnings False
>>>>> If FilmID = Null Then
>>>>>
>>>>> MsgBox "Delete operation cannot be carried out"
>>>>> 'End If
>>>>> Else
>>>>> 'DoCmd.SetWarnings False
>>>>> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE FilmID=" &
>>>>> Me.FilmID
>>>>> DoCmd.SetWarnings True
>>>>> End If
>>>>> End Sub
>>>>> ================================================== ===========
>>>>>
>>>>> so, the code i've got works 'somtimes' as i get the error message
>>>>> described before. (i've taken the double click event out, however that
>>>>> worked pretty well.)
>>>>>
>>>>> u know on the 'update' function, is it possible to check if the filmID is
>>>>> null (empty) and then the sql update runs. (cos if i do it now, i just
>>>>> get an error) i just wanted to create a little validation.
>>>>>
>>>>> thanx
>>>>>
>>>>> dev
>>>>>
>>>>>
>>>>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
>>>>> news:mn.ccbc7d623d00696f.33955@yahoo.no...
>>>>>> Oh - and forgot, sorry - after deleting a record, you might want to do
>>>>>> a
>>>>>>
>>>>>> me.requery
>>>>>>
>>>>>> to freshen up the display.
>>>>>>
>>>>>> --
>>>>>> Roy-Vidar
>>>>
>>>> I'm sorry, I can't see you've tried any of my suggestions from the code
>>>> you posted, so I don't know what to say, except to repeat
>>>>
>>>> Do try
>>>> 1 - save the record explicitly before doing anything else
>>>> 2 - run a requery of the form after the process is finished
>>>>
>>>> To test for contents in the control, you can for instance try
>>>>
>>>> if len(me!FilmID.value & vbNullString)>0 then
>>>> ' only if there's contents in the control, continue with routine
>>>>
>>>>
>>>> end if
>>>>
>>>> The next question I would ask, is whether this table/record is open,
>>>> and
>>>> contains unsaved changes in another form. If so, try explicitly saving
>>>> the record there too, either before opening this form, or before trying
>>>> to update/save from this form.
>>>>
>>>> --
>>>> Roy-Vidar[/color]
>>
>> Look at the Else clause of the If-Then-Else construct
>>
>> If <some condition> Then
>> ' perform some code (the updating stuff?)
>> Else
>> ' perform some other code (perhaps a message box)
>> End If
>>
>> It would be interesting to know whether the previous suggestions worked
>> with regards to the initial errors.
>>
>> --
>> Roy-Vidar[/color][/color]

I don't know. Similar stuff seems to work when I test this. Here's a
quick and dirty type up (meaning air code) ;-)

private sub cmdDelete_clikc()

dim strSql as string
dim intAnswer as integer

on error goto myerr

' save if there are unsaved changes
if me.dirty then me.dirty = false

' if you've got another form with this record open, containing
' unsaved changes ...
' if forms("frmNameOfForm").dirty then
' forms("frmNameOfForm").dirty = false
' end if

if len(me!FilmID.value & vbNullString)>0 then
intAnswer = msgbox("Wanna delete?", _
vbyesno+vbquestion, "Delete?")
if intAnswer = vbyes then
' I don't know the table name of this one
strsql = "delete from yourtable where filmid = " & _
me!FilmID.value
currentdb.execute strSql, dbfailonerror
strsql = "UPDATE tblFilm SET tblFilm.Available = -1 " & _
WHERE FilmID=" & Me!FilmID.Value
currentdb.execute strSql, dbfailonerror
end if
Else
msgbox "no film selected...", vbinformation
End If
me.requery

myexit:
exit sub
myerr:
msgbox err.number & " " & err.description
resume myexit
end sub

If this doesn't work, perhaps remove/comment the "on error" line, to
make it halt on the line causing the error. Perhaps posting the full
code again, as you are using it, and highlight the offending line.

Sometimes, the 3197 can also relate to corruption. So if nothing works,
then you could take a look here (search for 3197)
http://www.granite.ab.ca/access/corruption/symptoms.htm
(Tony Toews pages on corruption symptoms) and read a bit.

--
Roy-Vidar


PC Datasheet
Guest
 
Posts: n/a
#34: Feb 27 '06

re: deleting records


Why don't you and John Marshall go somewhere and kiss each other's A&$*##
!!! You're both A&$*##!!! who makes no contribution to this newsgroup.





"Arno R" <arraNOcomSPAM@tiscali.nl> wrote in message
news:4402dfc3$0$2030$ba620dc5@text.nova.planet.nl. ..

"PC Datasheet" <nospam@nospam.spam> schreef in bericht
news:w5rMf.4632$5M6.1741@newsread2.news.atl.earthl ink.net...[color=blue]
> Why don't you go and kiss John Marshall's A&$*##!!! You're an A&$*##!!!
> who
> makes no
> contribution to this newsgroup.[/color]

Why don't you stop 'contributing' lies, name-calling and sheer utter
nonsense here?

Why don't you stop posting your false claim that you are a 'resource'?
Why don't you stop posting your idiotic claim 1100+ users requested your
'help'?

Arno R


John Marshall, MVP
Guest
 
Posts: n/a
#35: Feb 27 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:h_DMf.4916$5M6.2930@newsread2.news.atl.earthl ink.net...[color=blue]
> Why don't you and John Marshall go somewhere and kiss each other's A&$*##
> !!! You're both A&$*##!!! who makes no contribution to this newsgroup.[/color]

The correct phrase is " who make no contributions to the newsgroup"

As usual you are wrong. Correcting erroneous information is helping the
newsgroup.

John... Visio MVP

PS: It's time to turn the page in the ""Trolls Guide to Flaming" and use a
different insult. Over the past few days, you have worn this one out.


DP
Guest
 
Posts: n/a
#36: Feb 27 '06

re: deleting records


ok, i've gto an error at this line;

CurrentDb.Execute strSql, dbfailonerror strsql = "UPDATE tblFilm SET
tblFilm.Available = -1 " & _ WHERE FilmID = " & Me!FilmID.Value"

its all in red, however, i tried it with my update line, and it all works
correctly.

the whole form works exactly how it should. i've put some of my own code as
well, as validation. i've finalyl got it all working!! did u want to see wat
i've got??

thanx for being patient and helping me, i appreciate it. :)

dev



"RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
news:mn.dae07d62b22bb83b.33955@yahoo.no...[color=blue]
> DP wrote in message <L3AMf.36273$Fy4.27110@newsfe4-win.ntli.net> :[color=green]
> > sorry.
> > i've been trying them, but with no success. i've tried saving as u
> > mentioned. i saved after an update, after the record was changed, etc...[/color][/color]
i[color=blue][color=green]
> > even tried saving the main form and subform. (when dirty, on load,[/color][/color]
etc...)[color=blue][color=green]
> > i've tried the requery as well, but none of them work. it still comes[/color][/color]
out[color=blue][color=green]
> > with that same error.
> >
> > i have not tried it in single form mode, as i need it in continous.
> >
> > i dont know wat else to do, as the error only comes after u try deleting[/color][/color]
a[color=blue][color=green]
> > record straight away. If u delete it after a min, or after restarting,[/color][/color]
the[color=blue][color=green]
> > error does not arise. however, thancx for all the help, i know u have[/color][/color]
not[color=blue][color=green]
> > started arguing with other people. lol. (somone actually mentioed[/color][/color]
deleting a[color=blue][color=green]
> > record through double clicking, which i dont want to do, as it does not[/color][/color]
feel[color=blue][color=green]
> > correct, if u know wat i mean). thats bad HCI!!
> >
> > i'll try the other bit of code u gave me now....
> >
> > thanx
> >
> > dev
> >
> > "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> > news:mn.d50c7d629e6d7b13.33955@yahoo.no...[color=darkred]
> >> DP wrote in message <xnmMf.60678$mf2.43175@newsfe6-win.ntli.net> :
> >>> wat if i wanted it to display a message when there is NO content in[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >>> field?
> >>>
> >>> thats wat u gave me;
> >>>
> >>> if len(me!FilmID.value & vbNullString)>0 then
> >>>
> >>>
> >>> cos i have to use an update query to update another table, and i[/color][/color][/color]
wanted to[color=blue][color=green][color=darkred]
> >>> create a little validation. (and to stop an error popping up when[/color][/color][/color]
there is[color=blue][color=green][color=darkred]
> >>> no record active.)
> >>>
> >>> (so i basically want it to display an error, when there is nothing to
> >>> delete).
> >>>
> >>> thanx
> >>>
> >>> dev
> >>>
> >>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> >>> news:mn.d3017d62d1c469d0.33955@yahoo.no...
> >>>> DP wrote in message <0ggMf.49097$Dn4.20522@newsfe3-gui.ntli.net> :
> >>>>> ok, so i've tried wat u have gave me, and it still is not working. i
> >>>>> understand the problem but dont have a clue wat else to do. i think[/color][/color][/color]
i've[color=blue][color=green][color=darkred]
> >>>>> tried almost everything.
> >>>>>
> >>>>> this is wat i've got; it might look confusing cos i been messing[/color][/color][/color]
around[color=blue][color=green][color=darkred]
> >>>>> with it for a week now;
> >>>>>
> >>>>> Private Sub cmdDeleteRecord_Click()
> >>>>>
> >>>>> msg = "Are you sure you want to delete this film rental record?"
> >>>>> Style = vbYesNo + vbQuestion + vbDefaultButton2
> >>>>>
> >>>>> Response = MsgBox(msg, Style, "Film Rental Database")
> >>>>> If Response = vbYes Then
> >>>>> DeleteRecord
> >>>>>
> >>>>> Else
> >>>>> MsgBox "You cancelled the delete operation"
> >>>>>
> >>>>> End If
> >>>>>
> >>>>> End Sub
> >>>>>
> >>>>>
> >>>>> ================================================== ===========
> >>>>>
> >>>>> Private Sub DeleteRecord()
> >>>>>
> >>>>> DoCmd.SetWarnings False
> >>>>> 'DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID="[color=blue][color=green][color=darkred]
> >>>>> & Me.FilmID
> >>>>> Update
> >>>>> DoCmd.SetWarnings False
> >>>>> DoCmd.RunCommand acCmdDeleteRecord
> >>>>>
> >>>>> DoCmd.SetWarnings True
> >>>>> End Sub
> >>>>>
> >>>>>[/color][/color][/color]
================================================== ===================[color=blue][color=green][color=darkred]
> >>>>>
> >>>>> Private Sub Update()
> >>>>> DoCmd.SetWarnings False
> >>>>> If FilmID = Null Then
> >>>>>
> >>>>> MsgBox "Delete operation cannot be carried out"
> >>>>> 'End If
> >>>>> Else
> >>>>> 'DoCmd.SetWarnings False
> >>>>> DoCmd.RunSQL "UPDATE tblFilm SET tblFilm.Available =True WHERE[/color][/color][/color]
FilmID=" &[color=blue][color=green][color=darkred]
> >>>>> Me.FilmID
> >>>>> DoCmd.SetWarnings True
> >>>>> End If
> >>>>> End Sub
> >>>>> ================================================== ===========
> >>>>>
> >>>>> so, the code i've got works 'somtimes' as i get the error message
> >>>>> described before. (i've taken the double click event out, however[/color][/color][/color]
that[color=blue][color=green][color=darkred]
> >>>>> worked pretty well.)
> >>>>>
> >>>>> u know on the 'update' function, is it possible to check if the[/color][/color][/color]
filmID is[color=blue][color=green][color=darkred]
> >>>>> null (empty) and then the sql update runs. (cos if i do it now, i[/color][/color][/color]
just[color=blue][color=green][color=darkred]
> >>>>> get an error) i just wanted to create a little validation.
> >>>>>
> >>>>> thanx
> >>>>>
> >>>>> dev
> >>>>>
> >>>>>
> >>>>> "RoyVidar" <roy_vidarNOSPAM@yahoo.no> wrote in message
> >>>>> news:mn.ccbc7d623d00696f.33955@yahoo.no...
> >>>>>> Oh - and forgot, sorry - after deleting a record, you might want to[/color][/color][/color]
do[color=blue][color=green][color=darkred]
> >>>>>> a
> >>>>>>
> >>>>>> me.requery
> >>>>>>
> >>>>>> to freshen up the display.
> >>>>>>
> >>>>>> --
> >>>>>> Roy-Vidar
> >>>>
> >>>> I'm sorry, I can't see you've tried any of my suggestions from the[/color][/color][/color]
code[color=blue][color=green][color=darkred]
> >>>> you posted, so I don't know what to say, except to repeat
> >>>>
> >>>> Do try
> >>>> 1 - save the record explicitly before doing anything else
> >>>> 2 - run a requery of the form after the process is finished
> >>>>
> >>>> To test for contents in the control, you can for instance try
> >>>>
> >>>> if len(me!FilmID.value & vbNullString)>0 then
> >>>> ' only if there's contents in the control, continue with routine
> >>>>
> >>>>
> >>>> end if
> >>>>
> >>>> The next question I would ask, is whether this table/record is open,
> >>>> and
> >>>> contains unsaved changes in another form. If so, try explicitly[/color][/color][/color]
saving[color=blue][color=green][color=darkred]
> >>>> the record there too, either before opening this form, or before[/color][/color][/color]
trying[color=blue][color=green][color=darkred]
> >>>> to update/save from this form.
> >>>>
> >>>> --
> >>>> Roy-Vidar
> >>
> >> Look at the Else clause of the If-Then-Else construct
> >>
> >> If <some condition> Then
> >> ' perform some code (the updating stuff?)
> >> Else
> >> ' perform some other code (perhaps a message box)
> >> End If
> >>
> >> It would be interesting to know whether the previous suggestions worked
> >> with regards to the initial errors.
> >>
> >> --
> >> Roy-Vidar[/color][/color]
>
> I don't know. Similar stuff seems to work when I test this. Here's a
> quick and dirty type up (meaning air code) ;-)
>
> private sub cmdDelete_clikc()
>
> dim strSql as string
> dim intAnswer as integer
>
> on error goto myerr
>
> ' save if there are unsaved changes
> if me.dirty then me.dirty = false
>
> ' if you've got another form with this record open, containing
> ' unsaved changes ...
> ' if forms("frmNameOfForm").dirty then
> ' forms("frmNameOfForm").dirty = false
> ' end if
>
> if len(me!FilmID.value & vbNullString)>0 then
> intAnswer = msgbox("Wanna delete?", _
> vbyesno+vbquestion, "Delete?")
> if intAnswer = vbyes then
> ' I don't know the table name of this one
> strsql = "delete from yourtable where filmid = " & _
> me!FilmID.value
> currentdb.execute strSql, dbfailonerror
> strsql = "UPDATE tblFilm SET tblFilm.Available = -1 " & _
> WHERE FilmID=" & Me!FilmID.Value
> currentdb.execute strSql, dbfailonerror
> end if
> Else
> msgbox "no film selected...", vbinformation
> End If
> me.requery
>
> myexit:
> exit sub
> myerr:
> msgbox err.number & " " & err.description
> resume myexit
> end sub
>
> If this doesn't work, perhaps remove/comment the "on error" line, to
> make it halt on the line causing the error. Perhaps posting the full
> code again, as you are using it, and highlight the offending line.
>
> Sometimes, the 3197 can also relate to corruption. So if nothing works,
> then you could take a look here (search for 3197)
> http://www.granite.ab.ca/access/corruption/symptoms.htm
> (Tony Toews pages on corruption symptoms) and read a bit.
>
> --
> Roy-Vidar
>
>[/color]


RoyVidar
Guest
 
Posts: n/a
#37: Feb 27 '06

re: deleting records


DP wrote in message <UdFMf.57097$m13.43647@newsfe5-gui.ntli.net> :[color=blue]
> ok, i've gto an error at this line;
>
> CurrentDb.Execute strSql, dbfailonerror strsql = "UPDATE tblFilm SET
> tblFilm.Available = -1 " & _ WHERE FilmID = " & Me!FilmID.Value"
>
> its all in red, however, i tried it with my update line, and it all works
> correctly.
>
> the whole form works exactly how it should. i've put some of my own code as
> well, as validation. i've finalyl got it all working!! did u want to see wat
> i've got??
>
> thanx for being patient and helping me, i appreciate it. :)
>
> dev
>
>
>[/color]

Happy you got it working!

--
Roy-Vidar


PC Datasheet
Guest
 
Posts: n/a
#38: Feb 27 '06

re: deleting records


Apparently kissing Arno's A&$*## isn't satisfying enough so you have to come
here and make an A&$*## of yourself. You're an A&$*## who makes no
contribution to this newsgroup. Go off somewhere else and get your
jollies!!!



"John Marshall, MVP" <lancucki@stonehenge.ca> wrote in message
news:wdKdnQ201Nd_i57ZRVn-rQ@magma.ca...[color=blue]
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:h_DMf.4916$5M6.2930@newsread2.news.atl.earthl ink.net...[color=green]
>> Why don't you and John Marshall go somewhere and kiss each other's A&$*##
>> !!! You're both A&$*##!!! who makes no contribution to this newsgroup.[/color]
>
> The correct phrase is " who make no contributions to the newsgroup"
>
> As usual you are wrong. Correcting erroneous information is helping the
> newsgroup.
>
> John... Visio MVP
>
> PS: It's time to turn the page in the ""Trolls Guide to Flaming" and use a
> different insult. Over the past few days, you have worn this one out.
>[/color]


David W. Fenton
Guest
 
Posts: n/a
#39: Feb 27 '06

re: deleting records


"DP" <DP@hotmail.com> wrote in
news:UdFMf.57097$m13.43647@newsfe5-gui.ntli.net:
[color=blue]
> ok, i've gto an error at this line;
>
> CurrentDb.Execute strSql, dbfailonerror
> strsql = "UPDATE tblFilm SET
> tblFilm.Available = -1 " & _ WHERE FilmID = " & Me!FilmID.Value"
>
> its all in red, however, i tried it with my update line, and it
> all works correctly.[/color]

The problem is that you've got the quotes in the wrong place, and a
line continuation character without a line break. It should be:

strsql = "UPDATE tblFilm SET tblFilm.Available = -1 _
WHERE FilmID = " & Me!FilmID.Value

However, I don't like using line continuation characters in
circumstances like that, since it really messes with my head in
regard to how strings are concatenated. I would write it like this:

strsql = "UPDATE tblFilm SET tblFilm.Available = -1"
strsql = strsql & " WHERE FilmID = " & Me!FilmID.Value

That makes it more clear (to me, at least) what part is a literal
string and what part is being picked up from a control on your form.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Keith Wilby
Guest
 
Posts: n/a
#40: Feb 28 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:qGkMf.4394$5M6.1803@newsread2.news.atl.earthl ink.net...[color=blue]
> In fact with using double clicking the user knows explicitly which record
> he is about to delete. In my opinion, a button on the main form to delete
> a record in the subform is confusing.[/color]

I bet your apps are full of gaudy colours too.

Keith.


PC Datasheet
Guest
 
Posts: n/a
#41: Feb 28 '06

re: deleting records


It must be time for a full moon; another A&%#$ has appeared!!! Why don't
you go kiss Arno's A&%#$.



"Keith Wilby" <here@there.com> wrote in message
news:44040fc1_1@glkas0286.greenlnk.net...[color=blue]
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:qGkMf.4394$5M6.1803@newsread2.news.atl.earthl ink.net...[color=green]
>> In fact with using double clicking the user knows explicitly which record
>> he is about to delete. In my opinion, a button on the main form to delete
>> a record in the subform is confusing.[/color]
>
> I bet your apps are full of gaudy colours too.
>
> Keith.
>[/color]


Keith Wilby
Guest
 
Posts: n/a
#42: Feb 28 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:%ZYMf.4812$S25.2941@newsread1.news.atl.earthl ink.net...[color=blue]
> It must be time for a full moon; another A&%#$ has appeared!!! Why don't
> you go kiss Arno's A&%#$.
>[/color]

Two redundant exclamation marks and a full-stop where there should be a
question mark ... and a rather repetitive and predictable theme to boot.
Oh, and it's a new moon here in the UK today.


PC Datasheet
Guest
 
Posts: n/a
#43: Feb 28 '06

re: deleting records


Since it's a new moon, why don't you go and moon Arno R. He loves seeing
that kind of stuff!!!


"Keith Wilby" <here@there.com> wrote in message
news:44047bf5$1_1@glkas0286.greenlnk.net...[color=blue]
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:%ZYMf.4812$S25.2941@newsread1.news.atl.earthl ink.net...[color=green]
>> It must be time for a full moon; another A&%#$ has appeared!!! Why don't
>> you go kiss Arno's A&%#$.
>>[/color]
>
> Two redundant exclamation marks and a full-stop where there should be a
> question mark ... and a rather repetitive and predictable theme to boot.
> Oh, and it's a new moon here in the UK today.
>[/color]


Arno R
Guest
 
Posts: n/a
#44: Feb 28 '06

re: deleting records



"PC Datasheet" <nospam@nospam.spam> schreef in bericht news:TD0Nf.4560$F56.922@newsread3.news.atl.earthli nk.net...[color=blue]
> Since it's a new moon, why don't you go and moon Arno R. He loves seeing
> that kind of stuff!!![/color]

You don't have a clue of what I love Steve... but,
I would be surprized to see *only a few* of the 1125 users supporting you...
Maybe since it's full moon, a new (bad) Martin will show up ??

Please Steve, get a life and 'buzz off' with your nonsense sig-lines...

Arno R
PC Datasheet
Guest
 
Posts: n/a
#45: Feb 28 '06

re: deleting records


Why don't you and Keith Wilby, Rob Oldfield and John Marshall go love each
other!!!


"Arno R" <arraNOcomSPAM@tiscali.nl> wrote in message
news:44049e9b$0$2028$ba620dc5@text.nova.planet.nl. ..

"PC Datasheet" <nospam@nospam.spam> schreef in bericht
news:TD0Nf.4560$F56.922@newsread3.news.atl.earthli nk.net...[color=blue]
> Since it's a new moon, why don't you go and moon Arno R. He loves seeing
> that kind of stuff!!![/color]

You don't have a clue of what I love Steve... but,
I would be surprized to see *only a few* of the 1125 users supporting you...
Maybe since it's full moon, a new (bad) Martin will show up ??

Please Steve, get a life and 'buzz off' with your nonsense sig-lines...

Arno R


Keith Wilby
Guest
 
Posts: n/a
#46: Mar 1 '06

re: deleting records


"PC Datasheet" <nospam@nospam.spam> wrote in message
news:TD0Nf.4560$F56.922@newsread3.news.atl.earthli nk.net...[color=blue]
> Since it's a new moon, why don't you go and moon Arno R. He loves seeing
> that kind of stuff!!!
>[/color]

You're a very sad and insecure individual Steve and you have my pity.


PC Datasheet
Guest
 
Posts: n/a
#47: Mar 1 '06

re: deleting records


Did you moon Arno R?


"Keith Wilby" <here@there.com> wrote in message
news:44055dd7$1_1@glkas0286.greenlnk.net...[color=blue]
> "PC Datasheet" <nospam@nospam.spam> wrote in message
> news:TD0Nf.4560$F56.922@newsread3.news.atl.earthli nk.net...[color=green]
>> Since it's a new moon, why don't you go and moon Arno R. He loves seeing
>> that kind of stuff!!!
>>[/color]
>
> You're a very sad and insecure individual Steve and you have my pity.
>[/color]


Closed Thread