how delete current record (2 Viewers)

Reese

Registered User.
Local time
Yesterday, 20:26
Joined
Jan 13, 2013
Messages
387
Yes! I believe I got it. Thanks!

Gah!!!! Now it doesn't work! How can it not work anymore?

I now get the following error:
Run-time error '2465': Application-defined or object-defined error

When I click the Debug option, the Visual Basic compiler highlights the following:
Call Forms("ZooMobile Booking Form").DelClientCmd_Click

To review, the entire sequence is:
Private Sub SelectCmd_Click()

Forms("ZooMobile Booking Form").SetFocus
Call Forms("ZooMobile Booking Form").DelClientCmd_Click
DoCmd.OpenForm "ZooMobile Booking Form", , , "[Client_ID] = " & Me.ClientIDTxt
RunCommand acCmdSaveRecord
DoCmd.Close acForm, "Booking Forms Client Search"

End Sub

The only thing that I can think of is that I tried adding another function in between the OpenForm and RunCommand sections but I then immediately deleted the change when this error occurred. Even after undoing that change it doesn't work anymore.
 

MyTech

Access VBA
Local time
Yesterday, 20:26
Joined
Jun 10, 2010
Messages
108
This code assumes that the form "ZooMobile Booking Form" is already open.
Was it already open, at least in the background?
 

Reese

Registered User.
Local time
Yesterday, 20:26
Joined
Jan 13, 2013
Messages
387
Yes, it was. The user first opens "ZooMobile Booking Form," from which they open "Booking Forms Client Search."

The whole purpose of this code is the user will be on the phone with a client, enter an organization into the Organization field and have the opportunity to search for said Organization in our past records, then select it if it comes up in a search. Unfortunately, by entering anything into the Organization field Access automatically creates a new entry--that's why I want the code to delete the current entry, then open the selected past entry.

I know it would be easier to start with the search form first, but that is awkward for the user. If someone has a better idea on how to accomplish this I'm more than willing to listen.
 

MyTech

Access VBA
Local time
Yesterday, 20:26
Joined
Jun 10, 2010
Messages
108
I can't follow up now, hope somebody else will take over..
 

Dick7Access

Dick S
Local time
Yesterday, 20:26
Joined
Jun 9, 2009
Messages
4,203
Code:
If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") = vbYes Then
   If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
    "This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation") = vbYes Then
         DoCmd.RunCommand acCmdDeleteRecord
   End If
End If

Great, Thanks Bob!
 

Users who are viewing this thread

Top Bottom