Error running delete query

Posted on 2008-11-06
Last Modified: 2010-04-30

I'm getting an error on the line of code given, any ideas why - syntax seems fine?

Set lessonTable = databaseConnection.OpenRecordset("DELETE * FROM StudentLesson WHERE IsLessonTypePlanned=TRUE AND LessonPlanID=" & lstLessonPlans.ItemData(lstLessonPlans.ListIndex) & " AND LessonStatus=8")

Open in new window

Question by:Unimatrix_001
    LVL 142

    Accepted Solution

    several things: DELETE does not open a recordset... so use execute instead of openrecordset
    next, what is the database? I assume access?
    next, waht is the data type of IsLessonTypePlanned and LessonPlanID?

    finally, what is the EXACT error message, please?
    LVL 3

    Author Closing Comment

    LVL 3

    Author Comment

    Thought it was quite strange returning a recordset - execute works fine, thanks! :-)

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now