Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Thanks.



    Where exactly do I put the code CurrentDB.Execute SQL_Text, dbFailOnError? I have tried different things, but can not get it to work.

    How about the editing part? I guess this complicated?

  2. #17
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    I am sorry to say but I have the same problem with this line:

    "Delete * From Table2 WHERE [Item number] = " & [Item number]

    Exactly where do I put it, and what comes first and what comes after?

    I feel so stupid asking these questions, but I do not know much about programming.

    Thank you very much!

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by Patience View Post
    Thanks.

    Where exactly do I put the code CurrentDB.Execute SQL_Text, dbFailOnError? I have tried different things, but can not get it to work.

    How about the editing part? I guess this complicated?
    You put it instead of:
    DoCmd.RunSQL (SQL_Text)

  4. #19
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by Patience View Post
    I am sorry to say but I have the same problem with this line:

    "Delete * From Table2 WHERE [Item number] = " & [Item number]

    Exactly where do I put it, and what comes first and what comes after?

    I feel so stupid asking these questions, but I do not know much about programming.

    Thank you very much!
    How are you deleting the record?

  5. #20
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Quote Originally Posted by RuralGuy View Post
    How are you deleting the record?
    Command button.

  6. #21
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Add the code supplied at the beginning of the code in the Command button.

  7. #22
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    When I do this it says:

    Compile error:

    Expected: line number or label or statement or end of statement

    Is there something missing?

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Post all of the code for the button here so we can see it. Please use the CODE tags (the # button).

  9. #24
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Private Sub Kommandoknap32_Click()
    On Error GoTo Err_Kommandoknap32_Click

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


    Exit_Kommandoknap32_Click:
    Exit Sub
    Err_Kommandoknap32_Click:
    MsgBox Err.Description
    Resume Exit_Kommandoknap32_Click

    End Sub

  10. #25
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's a link that helps convert those old DoMenuItem lines to the new RunCommand form: http://www.accessruncommand.com/domenuitem.htm
    I see nothing in the code you posted that would throw the error you mentioned.

  11. #26
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Thanks.

    No, this code will not throw an error, but it does when I add this:
    "Delete * From Table2 WHERE [Item number] = " & [Item number]

    Is it correct that this line should stand alone and not be in connection with other lines in the rest of the code for the button?

    Is correct that it starts with "?

  12. #27
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    CurrentDB.Execute "Delete * From Table2 WHERE [Item number] = " & [Item number], dbFailOnError

  13. #28
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    Thanks, I will try that.

    Have you seen my post under "Reports" where I ask about why some of my Word tables do not show in the report?

    I would very much like a solution to this.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-06-2011, 04:18 PM
  2. Copy form field to another table
    By Dega in forum Forms
    Replies: 6
    Last Post: 05-21-2010, 02:57 PM
  3. Replies: 2
    Last Post: 04-02-2010, 07:42 AM
  4. copy current record to new record
    By er_manojbisht in forum Forms
    Replies: 1
    Last Post: 02-27-2010, 05:31 PM
  5. Copy a record
    By RHall in forum Programming
    Replies: 2
    Last Post: 02-23-2006, 07:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums