Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    10

    Unanswered: Delete record harder than it seems

    Hey guys
    On a form i have got a combo box for the Product_Name [Product] and 3 text boxes linked to the combo box to show quantity[Product_Qua], unit[Unit] and section[Section] for the product. They are linked to the combo box by the =[Product].[Column](2) command.

    All i want to be able to do is when the user finds the product he/she wants to delete is click a delete command button and there we go record deleted.

    Ive tried the wizard but doesnt work and i dont know any code so yeah couldnt write my own script.

    Could anyone please give me some instuctions and code or w.e resources i need to be able to do this. Thankyou

  2. #2
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    119
    Does the wizard itself not work or the button that the wizard creates not work?

    If you use the wizard it creates a button with the following code attached to it and it works for me:

    Private Sub DelRecord_Click()
    On Error GoTo Err_DelRecord_Click


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

    Exit_DelRecord_Click:
    Exit Sub

    Err_DelRecord_Click:
    MsgBox Err.Description
    Resume Exit_DelRecord_Click

    End Sub

    To use this, create a button without the wizard and call it DelRecord. On the OnClick event for the button put the code.
    Regards
    JD

    Software-Matters

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by turbo910 View Post
    On a form i have got a combo box for the Product_Name [Product] and 3 text boxes linked to the combo box to show quantity[Product_Qua], unit[Unit] and section[Section] for the product. They are linked to the combo box by the =[Product].[Column](2) command.
    As I explained to the OP elsewhere, he/she is using a combobox to pull data then assigning the data from each column to a textbox.

    What he/she is not doing is retrieving a record! Since no record is being retrieved, no record is available to be deleted!

    The OP needs to create a new combobox, using the Combobox Wizard's third Option to retrieve records, then delete the record.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Nov 2009
    Posts
    10
    Mislinq i have followed your advie fromt he other forum and it most certainly works for me, But one question when it deletesa a record, if i type in the combo box to retrieve the record in the first place lets say test1, well then when i press click obv it deletes the record but the name is still remaining in the combo box when what would be ideal is to have a clear form?

    Any ideas?

Posting Permissions

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