vb6.0 code to detete all the records in a table

suthaharmca

New member
Local time
Tomorrow, 04:18
Joined
Dec 27, 2007
Messages
2
Hi,
I am using Vb6.0 as a front end and msaccess as the db.
i want 2 delete all the records in a table "Register" by clicking a menu
The connection is made using ADODB
Till now i hv the code

Private Sub mnudel_Click()
Docmd.SetWarnings False
Docmd.RunSql ("DELETE * FROM Register;")
Docmd.SetWarnings True
End Sub

But when i execute this a error msg displays
Run time error "424"
Object required

Whats the problem in me
plz help me to come out from this...
 
It's better to use a query. Make a "delete query" (I'm not sure about the english word for it) and run this query from your vba.

Edit: Sorry, dident read your post properly. I have no experience with Vb as front end, so I'm not sure if this will work.
 
Your code works fine in an all Access db, which yours is not. It's frequently a mistake to assume that VBA and VB 6 code is interchangeable! There are many, many, many differences. To make matters worse, there are many functions and procedures in VBA/VB6 that have identical names but perform differently. And further still, some of them behave the same in some versions of Access and differently in other versions!

While someone here might be able to help you troubleshoot this, since it is essentially a VB6 problem, not an Access problem, I suspect you'd be better off posting it in a VB6 forum/newsgroup.

Good luck with your project!

Linq
Linq
 
If you are doing this from vb6 you'll need to use your connection object to execute the delete query and I don't think you'll need worry about any warning but it has been a long time since I played with vb.

can't say I'm 100% there but hope it puts you on track.

Mick
 

Users who are viewing this thread

Back
Top Bottom