Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 09-12-2008, 10:49 PM   #1 (permalink)
In The Zone
 
Join Date: Nov 2008
Location: Kerala
Posts: 318
Default VB 6 :Datacontrol >Delete


i am just newbee in VB

>i cr8ed a project with Data control linked to MS access

>Everything is working fine but the delete Button
it giving me error if last record is deleted
> So i need 2 prevent the deletion of last access data
How i coded =


1)
Private Sub Command4_Click()
Data1.Recordset.Delete
End Sub

2)
Private Sub Command4_Click()
If Data1.Recordset.RecordCount >= 1 Then
Data1.Recordset.Delete
Data1.Refresh
End If
End Sub

3)
Private Sub Command4_Click()
data1.recordset.delete
if not data1.recordset.bof then
data1.recordset.moveprevious
elseif not data1.recordset.eof then
data1.recordset.movenext
else
msgbox"last Record"
end if
end sub

All these methods not working


Can any 1 pls tell me how to solve this problem .if possible with sample code

thanku vm
Rajesh345 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 10-12-2008, 12:07 AM   #2 (permalink)
Alpha Geek
 
Join Date: Jan 2007
Location: In your hearts
Posts: 828
Default Re: VB 6 :Datacontrol >Delete

every thing runs fine friend nothing but what do you mean by deletion of last access data
abhijangda is offline  
Old 11-12-2008, 08:01 AM   #3 (permalink)
In The Zone
 
Join Date: Nov 2008
Location: Kerala
Posts: 318
Default Re: VB 6 :Datacontrol >Delete

ty abhijangda in trying 2 help me . I got the solution from another website

How 2 code it

On Error GoTo Delete_Error

If MsgBox("Are you sure you want to delete this record?", _
vbQuestion + vbYesNo + vbDefaultButton2, _
"Confirm") = vbNo Then
Exit Sub
End If

'delete the current record
datAuthors.Recordset.Delete

'move to a valid record
cmdMoveNext_Click

Exit Sub

Delete_Error:
' This error will occur if you attempt to delete an author that is related to
' another table in the biblio.mdb database ...
MsgBox "This record cannot be deleted. Error code = " _
& Err.Number & vbCrLf & Err.Description, _
vbCritical, "Cannot Delete"




link of that site



http://www.vb6.us/tutorials/database-access-vb6-data-control-tutorial




Thank u
Rajesh345 is offline  
Closed Thread

Bookmarks

Thread Tools
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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to delete fun.exe ?? vivekrules Software Q&A 10 05-02-2008 02:27 PM
How to delete everything kumarn_2004 Software Q&A 8 04-01-2007 08:01 PM
Cannot delete..help!!! linardni QnA (read only) 11 29-06-2006 12:32 PM

 
Latest Threads
- by gforz
- by soumya
- by Sujeet
- by icebags
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:02 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2