Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete code 'complicated' says VBA 1

Status
Not open for further replies.

kupe

Technical User
Sep 23, 2002
376
This code has been working well. But moved to a new db, an Error Message says it is too complicated.

Is it, experts, please?

Private Sub cmdDeleteRecord_Click()

IsOk = MsgBox("Is this really for the chop?", vbYesNoCancel, "Zapped!")
If ((IsOk = 6) Or (IsOk = 2)) Then
stDocName = "frmZap"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Me.txtDelete.Value = "Yes" Else 'exit if either No or Cancel
Exit Sub
End If
Me.Requery

End Sub
 
I'm not sure where the error is occuring as you have not highlighted this but your use of the vbyesno I have not seen before.

i've always used it like so
Code:
If vbNo = MsgBox("This will produce missing / out of date propriety document letters, are you sure you want to do this?", vbYesNo) Then
Exit Sub
End If

I thought vbyes , vbno and vbcancel were inbuilt variables that are set acording to the button pressed.

so i would use
Code:
Private Sub cmdDeleteRecord_Click()

If vbYes = MsgBox("Is this really for the chop?", vbYesNoCancel, "Zapped!") Then
        stDocName = "frmZap"
        DoCmd.OpenForm stDocName, , , stLinkCriteria
        Me.txtDelete.Value = "Yes"  
        Me.Requery
End If

End Sub
 
Thanks very much, 1DMF. That looks much better. Cheers
 
That was some pretty amazing help with ftp! I've taken a copy, very gratefully. You could be setting new records for Tek-Tips. There will be a lot of downloads from your site, I should think. Congratulations. Cheers
 
Wow, you took the time to notice, yep that thread sure is getting some good feedback.

Well what could i do, I needed the answer, I looked, I found nothing, I could hardly not share the answer once i'd worked it out, that's just not cricket old boy!

I had seen how many others had been looking for the answer and wanted to put back into Tek-Tips some of the help I constantly receive.

It's a great forum this place and I'm just glad to be part of it and hope I've saved a few others out there the headache of FTP in Access.

:)
 
Very glad you're here, 1DMF. Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top