Results 1 to 5 of 5

Thread: [02/03] How to delete a full row ms access

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    [02/03] How to delete a full row ms access

    Hi People

    Basically I want to be able to specify a full row of data to be deleted in a ms access db, how do I do this?
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [02/03] How to delete a full row ms access

    Execute a sql delete statement with a where clause to identify which record to delete.

    "DELETE Table1.* FROM Table1 WHERE Field1 = 'Something';"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Re: [02/03] How to delete a full row ms access

    Hi

    Thanks for your reply, however I cannot think of a method to delete a particular row, as data will be added and deleted, below is the coding.

    p.s. the info entered into the input box, isnt saving to the DB, if anyone has nay ideas?

    VB Code:
    1. If x1.Checked Then
    2.             inputdata(0) = InputBox("How did you solve this problem")
    3.             'storing text
    4.  
    5.             Try
    6.                 cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\PermenantDB.mdb;")
    7.                 cn.Open()
    8.  
    9.                 str = "INSERT INTO Table1 (Column7) VALUES (@Column7)"
    10.                 cmd = New OleDbCommand(str, cn)
    11.  
    12.                 '##### name
    13.                 cmd.Parameters.Add("@Column7", OleDbType.VarChar)
    14.                 cmd.Parameters("@Column7").Value = (inputdata(0)) 'not saving data?
    15.  
    16.             Catch ex As Exception
    17.                 'Display the error message in a message box then clear the error      
    18.                 MsgBox(ex.Message, MsgBoxStyle.OKOnly)
    19.                 Err.Clear()
    20.             End Try
    21.             cn.Close()
    22.  
    23.             'only removes records from list boxes, not the database
    24.             lstid.Items.RemoveAt(1)
    25.             lstdate.Items.RemoveAt(1)
    26.             lstname.Items.RemoveAt(1)
    27.             lstdate.Items.RemoveAt(1)
    28.             lstproblem.Items.RemoveAt(1)
    29.             lstproblemdescription.Items.RemoveAt(1)
    30.  
    31. 'then remove row 1 from database
    32.         End If
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Re: [02/03] How to delete a full row ms access

    If anyone could even attempt to solve why the data entered into the input message box isnt saving to the database, I would really appriciate it.
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    489

    Re: [02/03] How to delete a full row ms access

    Still looking at that input message, I have even used a textbox to replaced it as a test, but it still doesnt work. My code is identical to other code which works perfectly.
    Learning C♯

    Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)

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