Sign Up |  Live StatsLive Stats    Articles 35,345| Comments 159,790| Members 17,820, Newest waheguruhelpme| Online 223
Home Contact
 (Forgotten?): 
    Sikhism

   
                                                                     Your Banner Here!    

problems deleting a specific record

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 400 USD, Received: 35 USD (9%)
Please Donate...
Related Topics...
Thread Thread Starter Forum Replies Last Post
problem displaying specific record MartinR Information Technology 10 28-Jul-2006 08:31 AM
Open subform to a specific record fabianjones@gmail.com Information Technology 0 28-Jul-2006 08:17 AM
Deleting record with all its subforms/relationships iTanas Information Technology 1 28-Jul-2006 08:15 AM
RE: print a specific record Ofer Cohen Information Technology 0 28-Jul-2006 07:59 AM
Deleting a record or records. Paul S Information Technology 1 19-Nov-2005 22:00 PM


Tags
problems, deleting, specific, record
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:41 AM
andriulli@gmail.com's Avatar andriulli@gmail.com
Guest
 
Posts: n/a
   
   
problems deleting a specific record

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
Hello.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/13914-problems-deleting-a-specific-record.html
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914

I have a listbox and a delete button. Records are being displayed in
the listbox using three columns. The first column, TrackID is the
primary key for the record. i want the user to be able to click the
delete button, have a msg window popup and confirm the deletion, and
then delete the record if the user clicks yes. my problem is that the
record is not deleting, here is my code (History is the listbox):

If MsgBox("Are you sure you wish to delete this ticket?", vbExclamation
+ vbYesNo + vbDefaultButton2, "Confirm Record Deletion") = vbYes Then

DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE FROM [Equipment Tracking Log] WHERE [Equipment
Tracking Log].EquipNumber = '" & Me.History.Value & "'"

DoCmd.SetWarnings True

End If

Any help would be appreciated.




 
Do share your immediate thoughts or reactions on this issue? We value your views! Login Now! or Sign Up Today! to share your views with us.. Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:41 AM
Biz Enhancer's Avatar Biz Enhancer
Guest
 
Posts: n/a
   
   
RE: problems deleting a specific record

Hi,

Try replacing the "me.History. value" with "Forms![your form name]!history"
You also need to delete the entire row using the tbl.*.

DoCmd.RunSQL "DELETE [Equipment Tracking Log].*, [Equipment Tracking
Log].EquipNumber FROM [Equipment Tracking Log] WHERE ((([Equipment Tracking
Log].EquipNumber)=[Forms]![your form here]![history]));"

Hope it helps.
Regards,
Nick.
"andriulli@gmail.com" wrote:

> Hello.
>
> I have a listbox and a delete button. Records are being displayed in
> the listbox using three columns. The first column, TrackID is the
> primary key for the record. i want the user to be able to click the
> delete button, have a msg window popup and confirm the deletion, and
> then delete the record if the user clicks yes. my problem is that the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> record is not deleting, here is my code (History is the listbox):
>
> If MsgBox("Are you sure you wish to delete this ticket?", vbExclamation
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> + vbYesNo + vbDefaultButton2, "Confirm Record Deletion") = vbYes Then
>
> DoCmd.SetWarnings False
>
> DoCmd.RunSQL "DELETE FROM [Equipment Tracking Log] WHERE [Equipment
> Tracking Log].EquipNumber = '" & Me.History.Value & "'"
>
> DoCmd.SetWarnings True
>
> End If
>
> Any help would be appreciated.
>
>

Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:41 AM
andriulli@gmail.com's Avatar andriulli@gmail.com
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

I updated the statement to what you advised, but still no luck. I don't
get any errors, the record just isn't deleted from the table. Here is
my code:

Private Sub DeleteEntryButton_Click()

If MsgBox("Are you sure you wish to delete this ticket?", vbExclamation
+ vbYesNo + vbDefaultButton2, "Confirm Record Deletion") = vbYes Then

DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE [Equipment Tracking Log].*, [Equipment Tracking
Log].EquipNumber FROM [Equipment Tracking Log] WHERE ((([Equipment
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Tracking Log].EquipNumber) = [Forms]![CCUEquipmentList]![History]));"

DoCmd.SetWarnings True

End If

End Sub

Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:41 AM
Biz Enhancer's Avatar Biz Enhancer
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

Hmmm. That should have worked.
I suspect that the problem may be concerning the "History" field. Is this a
combo box or list? If so, then make sure the bound column is the right one
for the equipNumber.
Else if it is a textbox, do you get an exact match to the record you are
trying to delete?

If you can give a bit of info about the "history" field and control, that
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
may unlock the problem.

Regards,
Nick.

"andriulli@gmail.com" wrote:

> I updated the statement to what you advised, but still no luck. I don't
> get any errors, the record just isn't deleted from the table. Here is
> my code:
>
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> Private Sub DeleteEntryButton_Click()
>
> If MsgBox("Are you sure you wish to delete this ticket?", vbExclamation
> + vbYesNo + vbDefaultButton2, "Confirm Record Deletion") = vbYes Then
>
> DoCmd.SetWarnings False
>
> DoCmd.RunSQL "DELETE [Equipment Tracking Log].*, [Equipment Tracking
> Log].EquipNumber FROM [Equipment Tracking Log] WHERE ((([Equipment
> Tracking Log].EquipNumber) = [Forms]![CCUEquipmentList]![History]));"
>
> DoCmd.SetWarnings True
>
> End If
>
> End Sub
>
>

Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:42 AM
RoyVidar's Avatar RoyVidar
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

"andriulli@gmail.com" wrote in message
<1153922865.652113.252220@p79g2000cwp.googlegroups. com>:
> I updated the statement to what you advised, but still no luck. I
> don't get any errors, the record just isn't deleted from the table.
> Here is my code:
>
> Private Sub DeleteEntryButton_Click()
>
> If MsgBox("Are you sure you wish to delete this ticket?",
> vbExclamation + vbYesNo + vbDefaultButton2, "Confirm Record
> Deletion") = vbYes Then


' DoCmd.SetWarnings False

> DoCmd.RunSQL "DELETE [Equipment Tracking Log].*, [Equipment Tracking
> Log].EquipNumber FROM [Equipment Tracking Log] WHERE ((([Equipment
> Tracking Log].EquipNumber) = [Forms]![CCUEquipmentList]![History]));"
>
> DoCmd.SetWarnings True
>
> End If
>
> End Sub


What message do you get if you don't turn off the warnings? Also, would
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
it differ if you included the value into the string, and not the
reference
....Where [Equipment Tracking Log].EquipNumber) = " & _
Me.History.Value

If it's a text field, then add single quotes
....Where [Equipment Tracking Log].EquipNumber) = '" & _
Me.History.Value & "'"

Also, a little tricks, in stead of stuffing it all into a docmd
statement, assign it to a string

dim strSql as string
strSql = "DELETE FROM [Equipment Tracking Log] e " & _
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
"WHERE e.EquipNumber = " & Me.History.Value

then run like this (here using the execute method of the current db)

currentdb.execute strsql, dbfailonerror

or you could do a

debug.print strsql

then pick up the sql statement in the immediate pane (ctrl+g), try
studying it, or copy/paste to the SQL view of the query tool.

--
Roy-Vidar


Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:42 AM
andriulli@gmail.com's Avatar andriulli@gmail.com
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

My History listbox is an unbounded listbox that shows all of the
related tickets, through a query, a piece of equipment has. Tickets are
kept track of in another table called Tickets. Everytime an employee
signs out a piece of equipment they create a ticket. I want to be able
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
to highlight a row in the History listbox and delete the ticket that
corresponds to that row.

Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:42 AM
Pieter Wijnen's Avatar Pieter Wijnen
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

If multiselect is on for the listbox it either has to be turned off (it will
always yield Null) or you have
to write additional code

Dim CurVal As Variant
Dim lb As Access.Listbox
Dim Db As DAO.Database

Set Db = Access.CurrentDb()
Set lb = Me.History
With lb
For Each CurVal In .ItemsSelected
Db.Execute "DELETE ... FROM ... WHERE ... = " & .ItemData(CurVal),
DAO.dbFailOnError ' Enclosed By (') for Text Fields
Next
End With

Set lb = Nothing
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Set Db = Nothing

HTH

Pieter

PS Please all retain the full thread when answering


wrote in message
news:1153926332.481938.323200@b28g2000cwb.googlegr oups.com...
> My History listbox is an unbounded listbox that shows all of the
> related tickets, through a query, a piece of equipment has. Tickets are
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> kept track of in another table called Tickets. Everytime an employee
> signs out a piece of equipment they create a ticket. I want to be able
> to highlight a row in the History listbox and delete the ticket that
> corresponds to that row.
>



Reply With Quote
  #8 (permalink)  
Old 28-Jul-2006, 08:42 AM
Pieter Wijnen's Avatar Pieter Wijnen
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

If multiselect is on for the listbox it either has to be turned off (it will
always yield Null) or you have
to write additional code

Dim CurVal As Variant
Dim lb As Access.Listbox
Dim Db As DAO.Database

Set Db = Access.CurrentDb()
Set lb = Me.History
With lb
For Each CurVal In .ItemsSelected
Db.Execute "DELETE ... FROM ... WHERE ... = " & .ItemData(CurVal),
DAO.dbFailOnError ' Enclosed By (') for Text Fields
Next
End With

Set lb = Nothing
Set Db = Nothing

HTH

Pieter

PS Please all retain the full thread when answering


wrote in message
news:1153926332.481938.323200@b28g2000cwb.googlegr oups.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> My History listbox is an unbounded listbox that shows all of the
> related tickets, through a query, a piece of equipment has. Tickets are
> kept track of in another table called Tickets. Everytime an employee
> signs out a piece of equipment they create a ticket. I want to be able
> to highlight a row in the History listbox and delete the ticket that
> corresponds to that row.
>




--
----------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4367 spam emails to date.
Paying users do not have this message in their emails.
Get the free SPAMfighter here: http://www.spamfighter.com/len


Reply With Quote
  #9 (permalink)  
Old 28-Jul-2006, 08:42 AM
Biz Enhancer's Avatar Biz Enhancer
Guest
 
Posts: n/a
   
   
Re: problems deleting a specific record

  Donate Today!  
OK. Assuming that the query on the ticket table was the ticketID as the first
column and the Equipnumber in a column further down the query, you would need
to ensure that the bound column is not column 1 (if that is the ticketid) but
is the column that relates to equipNumber.

Although do you want to be deleting from the [Equipment Tracking Log] or the
[Ticket] table. If it is the created ticket in the Ticket table that is the
target then surely the ticket table entry needs to be deleted.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
Mind you that is just a stab in the dark!

Post the listbox source SQL, hopefully that will shed some more light.

Regards,
Nick.

"andriulli@gmail.com" wrote:

> My History listbox is an unbounded listbox that shows all of the
> related tickets, through a query, a piece of equipment has. Tickets are
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13914
> kept track of in another table called Tickets. Everytime an employee
> signs out a piece of equipment they create a ticket. I want to be able
> to highlight a row in the History listbox and delete the ticket that
> corresponds to that row.
>
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Gurbani Jukebox
Listen to Gurbani while surfing SPN!
» Active Discussions
sikhism Who is "Mohan"?
Today 08:46 AM
22 Replies, 335 Views
sikhism How important is Matha...
Today 08:12 AM
59 Replies, 1,038 Views
sikhism need urgent advice.......
Today 06:46 AM
6 Replies, 81 Views
sikhism ਨਾਮਾ
Today 06:37 AM
2 Replies, 53 Views
sikhism Sikh Diamonds Video...
Today 04:23 AM
6 Replies, 116 Views
sikhism Are Creator and Creation...
Today 01:30 AM
44 Replies, 2,837 Views
sikhism Herman Hesse,...
Today 00:54 AM
13 Replies, 229 Views
sikhism On a Scale of Most...
Yesterday 21:42 PM
30 Replies, 1,277 Views
sikhism I became victim by...
Yesterday 19:50 PM
0 Replies, 44 Views
sikhism Sikh Books downloads
Yesterday 15:39 PM
2 Replies, 66 Views
sikhism Salok Sheikh Farid ji...
Yesterday 09:35 AM
0 Replies, 47 Views
sikhism In Punjab, three farmers...
Yesterday 05:36 AM
0 Replies, 49 Views
sikhism Supernatural Sikhs, what...
Yesterday 03:45 AM
19 Replies, 414 Views
sikhism Sukhmani Sahib Astpadi...
26-May-2012 22:57 PM
0 Replies, 51 Views
Do You Think You Are...
26-May-2012 09:59 AM
94 Replies, 8,258 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.2

All times are GMT +6.5. The time now is 09:47 AM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.55592 seconds with 30 queries