Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005

    Unanswered: docmd.runcommand for open form

    I have a form where users enter a client. If they enter a client name, it checks for possible duplicates. If possible duplicates exist, a popup form displays all the possible duplicates in a listbox. if the user sees the client they are adding, they dblclick on the client, to display the information on the previous form.

    My problem is that I need to delete the record that is currently on the first form where they were entering in information before displaying the client that they dblclicked on. I have tried making the form the activeform then running this statement: docmd.runcommand acCmdDeleteRecord, but it won't work. I can use a dynamic sql statement and pass through some values, but I was wondering if anyone knew how I could get this to work without using a dynamic statement.

  2. #2
    Join Date
    Apr 2004
    Derbyshire, UK
    Provided Answers: 2

    I assume that the new client information is not complete before the possible duplications are displayed ? (you don't say what happens when you Delete!).

    If not then I would suggest trying Undo rarther than Delete.

    If the origianal form is based on the client table/records then you could try something like this on selecting the suggested duplicate.

    Assuming the Client PK (ID) is available in the duplicates form!

    Sub GoToClient(ClientID As Long)
            With Forms![frmClients]
                .RecordsetClone.FindFirst "ID = " & ClientID
                .Bookmark = .RecordsetClone.Bookmark
            End With
    End Sub
    BTW FormIsLoaded is function for detecting/verifying a form is open using SysCmd method.

    HTH ?


Posting Permissions

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