Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    delete from ListBox (Access 2000)

    Cannot delete from List Box.

    I cannot delete with the following code, which is not working, and obviously wrong:
    Private Sub Command40_Click()
    Dim strSQLDel As String
    strSQLDel = "DELETE * FROM [tblClients] WHERE ClientID = " & Me![list]!Clientid
    DoCmd.RunSQL strSQLDel

    End Sub

    I want to delete a chosen client from a ListBox called List38.On trying to delete the client, through the above code, I receive the following message:

    Run time error 451 roperty let procedure and property get procedure
    Did not return an object

    May I receive some help?

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Toronto, Ontario, Canada
    Thanked 0 Times in 0 Posts

    Re: delete from ListBox (Access 2000)

    For your SQL string try:

    strSQLDel = "DELETE * FROM [tblClients] WHERE ClientID = " & Me![list].Column(x)

    where x it the column number that holds the ClientID Field.

    Just remember that List Box Columns are zero-based and not 1 based.

    i.e. the first column = .column(0)
    the second column = .column(1)

    and so on.
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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