Help! Beginner with Error 2001, operation cancelled

A

Angela

I am just beginning VBA coding and have fell into having
to repair someone else's code in a critical database and
must get it repaired ASAP!

Here is the original code that seems to be causing the
problem:

Option Explicit


Function openNextFormCloseCurrent(FormNameToOpen As
String, curForm As String)
Dim stLinkCriteria As String
Dim frmCurrentForm As String
Dim stDoc1 As String

frmCurrentForm = curForm
stDoc1 = FormNameToOpen

DoCmd.OpenForm stDoc1, , , stLinkCriteria

DoCmd.Close acForm, frmCurrentForm
End Function

Function FilterNextFormCloseCurrent(FormNameToOpen As
String, curForm As String, intID As Integer)
Dim stLinkCriteria As String
Dim stDoc1 As String
Dim frmCurrentForm As String
Dim intProjCriteria As Integer

intProjCriteria = intID

frmCurrentForm = curForm
stDoc1 = FormNameToOpen
stLinkCriteria = "[ImprovProjMainTblID]=" &
intProjCriteria

DoCmd.OpenForm stDoc1, , , stLinkCriteria

DoCmd.Close acForm, frmCurrentForm
End Function

I have added exit statements and error handling but after
almost a week without the error it has recurred. I can
not open the forms in any view. I was told the person
who wrote the code "fixed" the problem by deleting the
forms and re-importing them from a backup.

Your help is greatly appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top