CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    27

    Deleting a record

    This query works fine...

    SELECT exp.ID AS [REC_ID], exp.date AS [Date], cat.description AS Category, est.name AS Establishment, Choose(exp.payment+1,'Cash','Credit Card','Check') AS [Payment Mode],
    Choose(exp.payment+1,crd.company,'N/A','N/A') AS [Credit Card], exp.amount AS Amount
    FROM tblCreditCards AS crd RIGHT JOIN (tblCategories AS cat RIGHT JOIN (tblEstablishments AS est RIGHT JOIN tblExpenses AS exp ON est.id=exp.establishment) ON cat.id=exp.category) ON crd.id=exp.credit_card
    ORDER BY exp.date;

    ...but why can't I delete a record from an ado recordset?

    is it because of the RIGHT JOIN? or how the tables where arranged in the JOIN statement?

    by the way...this is the error...


    Run-time error: '-2147467259 (80004005)'

    Insufficient key column information for updating or refreshing.


    Thanks a lot!

  2. #2
    Join Date
    Jan 2001
    Posts
    486
    If your SELECT works fine and the problem is with your DELETE, why post the code for your SELECT?

    Perhaps if you share the code that is causing prblems it might be easier to help you with your problem.
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

  3. #3
    Join Date
    Apr 2004
    Location
    Austria
    Posts
    43
    DELETE FROM WHERE .. delete the record through SQL command..

    greetings UNI

  4. #4
    Join Date
    Apr 2004
    Posts
    27
    I posted the SELECT query because when I delete a record from MS Access table browser, I don't encounter errors...only on VB when I use recordset.Delete.

  5. #5
    Join Date
    Apr 2004
    Posts
    27
    I tried the DELETE FROM WHERE and it worked!

    But howcome the recordset.delete doesn't work?

  6. #6
    Join Date
    Apr 2004
    Location
    Austria
    Posts
    43
    Don't really know because I never used recordset.delete .. SQL ist a wonderful language and it is much more portable. if using ado you can just change the connection string and you can use a SQL server instead of the mdb database. or mysql etc.. so DELET FROM is always a better choise than using these built in functions.

    greetings UNI

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured