The OpenForm action was cancelled since upgrade from 2003 to 2007

D

David Harris

We are a National Charity and since we upgraded from Microsoft Office 2003 to
2007 an error comes up on clicking on an Open Form.
The error 'The OpenForm action was cancelled' now comes up when clicking on
the button where it worked in 2003.

Please help ASAP as this one of our main database's.

Thanks.
 
D

Dirk Goldgar

David Harris said:
We are a National Charity and since we upgraded from Microsoft Office 2003
to
2007 an error comes up on clicking on an Open Form.
The error 'The OpenForm action was cancelled' now comes up when clicking
on
the button where it worked in 2003.

Please help ASAP as this one of our main database's.


That's not much information to go on, and I can only offer a couple of
thoughts. The main thing I've been seeing that causes Access 2003 databases
not to work in Access 2007 is that A2007, by default, disables VBA code.
Make sure that your database is in a Trusted Location, as identified via the
Trust Center settings. Also, you could be running into issues with macro
security (though I don't see how), so investigate those aspects. Make sure
your database has no broken references: open the VB Editor and click
Tools -> References, go down the list of checked references and make sure no
references are listed as MISSING.

Is it one particular button that isn't working, or is it all of them? Is
that button executing VBA code (an event procedure) to open the form, or is
it running a macro?
 
D

David Harris

It only seems to be this one button.
It is in a trusted Location.
There are no broken references.
It is running VBA (See below).

Private Sub Open1stAccessCourse_Click()
On Error GoTo Err_Open1stAccessCourse_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Fm1/9 C1 Access Course"

stLinkCriteria = "[Client Reference]=" & Me![Client Reference Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open1stAccessCourse_Click:
Exit Sub

Err_Open1stAccessCourse_Click:
MsgBox Err.Description
Resume Exit_Open1stAccessCourse_Click

End Sub

Regards,

David
 
D

Dirk Goldgar

David Harris said:
It only seems to be this one button.
It is in a trusted Location.
There are no broken references.
It is running VBA (See below).

Private Sub Open1stAccessCourse_Click()
On Error GoTo Err_Open1stAccessCourse_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Fm1/9 C1 Access Course"

stLinkCriteria = "[Client Reference]=" & Me![Client Reference Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open1stAccessCourse_Click:
Exit Sub

Err_Open1stAccessCourse_Click:
MsgBox Err.Description
Resume Exit_Open1stAccessCourse_Click

End Sub


I see nothing wrong with that, so long as [Client Reference] is a numeric
field, and not text. I do notice the difference between the names "Client
Reference" and "Client Reference Number", but I assume that's not an error,
since you say this is code that was working under Access 2003. You didn't
rename the field in the table, did you?

The next thing I would look at is the form being opened. Is there code or a
macro in its Open event that might be causing the problem? Can you open the
form directly from the navigation pane?
 
D

David Harris

We didn't rename any fields. We just upgrade Office from 2003 to 2007.
There are no Macro's.
I can't open the form from the navigation panel as it requires FM1 Personal
Details open at the time (which is the form the command button it on to open
up the form that is not working).

Dirk Goldgar said:
David Harris said:
It only seems to be this one button.
It is in a trusted Location.
There are no broken references.
It is running VBA (See below).

Private Sub Open1stAccessCourse_Click()
On Error GoTo Err_Open1stAccessCourse_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Fm1/9 C1 Access Course"

stLinkCriteria = "[Client Reference]=" & Me![Client Reference Number]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open1stAccessCourse_Click:
Exit Sub

Err_Open1stAccessCourse_Click:
MsgBox Err.Description
Resume Exit_Open1stAccessCourse_Click

End Sub


I see nothing wrong with that, so long as [Client Reference] is a numeric
field, and not text. I do notice the difference between the names "Client
Reference" and "Client Reference Number", but I assume that's not an error,
since you say this is code that was working under Access 2003. You didn't
rename the field in the table, did you?

The next thing I would look at is the form being opened. Is there code or a
macro in its Open event that might be causing the problem? Can you open the
form directly from the navigation pane?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

David Harris said:
I can't open the form from the navigation panel as it requires FM1
Personal
Details open at the time (which is the form the command button it on to
open
up the form that is not working).


What happens if you try? Do you get a parameter prompt, a user-designed
error message, or the same error message?
 
D

David Harris

I opened the Personal Details page and instead of clicking on the button I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.
 
D

Dirk Goldgar

David Harris said:
I opened the Personal Details page and instead of clicking on the button I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.


That leads me to believe that there is a problem with the criterion being
specified in your Open1stAccessCourse_Click() event procedure. As a first
step to investigate this, set a breakpoint on the line
DoCmd.OpenForm stDocName, , , stLinkCriteria

Then trigger the procedure by clicking the button. When code execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate window in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of stLinkCriteria
should be displayed. Copy and paste that into a reply to this message, so I
can see if there is anything odd about it. Then return to the VB editor and
press F5 to let the code continue, and confirm that the error was raised as
before.
 
D

David Harris

Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click the
button.

After pressing F5 th same error comes up.

Regards,

David
 
B

BruceM

Dirk suggested a very specific course of action. How did that go? Are you
clear on how to set a break point and the rest of it?

If you are unclear about setting a break point, open the VBA editor. Click
the vertical bar to the left of the line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

A red dod will appear in the vertical bar, and the line of code will be
highlighted. Click the button to run the code. It will stop at the
selected line. From there the instructions should be self-evident.

David Harris said:
Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click
the
button.

After pressing F5 th same error comes up.

Regards,

David

Dirk Goldgar said:
That leads me to believe that there is a problem with the criterion being
specified in your Open1stAccessCourse_Click() event procedure. As a
first
step to investigate this, set a breakpoint on the line


Then trigger the procedure by clicking the button. When code execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate window in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of stLinkCriteria
should be displayed. Copy and paste that into a reply to this message,
so I
can see if there is anything odd about it. Then return to the VB editor
and
press F5 to let the code continue, and confirm that the error was raised
as
before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

David Harris

I completed the steps and replied with the following.

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click the
button.
After pressing F5 th same error comes up.

BruceM said:
Dirk suggested a very specific course of action. How did that go? Are you
clear on how to set a break point and the rest of it?

If you are unclear about setting a break point, open the VBA editor. Click
the vertical bar to the left of the line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

A red dod will appear in the vertical bar, and the line of code will be
highlighted. Click the button to run the code. It will stop at the
selected line. From there the instructions should be self-evident.

David Harris said:
Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click
the
button.

After pressing F5 th same error comes up.

Regards,

David

Dirk Goldgar said:
I opened the Personal Details page and instead of clicking on the button
I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.


That leads me to believe that there is a problem with the criterion being
specified in your Open1stAccessCourse_Click() event procedure. As a
first
step to investigate this, set a breakpoint on the line

DoCmd.OpenForm stDocName, , , stLinkCriteria

Then trigger the procedure by clicking the button. When code execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate window in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of stLinkCriteria
should be displayed. Copy and paste that into a reply to this message,
so I
can see if there is anything odd about it. Then return to the VB editor
and
press F5 to let the code continue, and confirm that the error was raised
as
before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
B

BruceM

I didn't mean to jump in on the thread. You referred to [Client
Reference]=1577 as the Criteria, so I thought you were referring to
something other than the string stLinkCriteria. I thought I could provide
some clarification. My apologies for the misunderstanding

I will just suggest that you press F8 instead of F5 after the break point,
so that you can discover which line of code exactly is producing the error.

Also, when you say "nothing happens" when you try to open the form from the
database window (I assume that's what you mean by "forms list"), do you mean
it sits there and doesn't even begin to open?

David Harris said:
I completed the steps and replied with the following.

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click
the
button.
After pressing F5 th same error comes up.

BruceM said:
Dirk suggested a very specific course of action. How did that go? Are
you
clear on how to set a break point and the rest of it?

If you are unclear about setting a break point, open the VBA editor.
Click
the vertical bar to the left of the line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

A red dod will appear in the vertical bar, and the line of code will be
highlighted. Click the button to run the code. It will stop at the
selected line. From there the instructions should be self-evident.

David Harris said:
Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I
click
the
button.

After pressing F5 th same error comes up.

Regards,

David

:

message
I opened the Personal Details page and instead of clicking on the
button
I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.


That leads me to believe that there is a problem with the criterion
being
specified in your Open1stAccessCourse_Click() event procedure. As a
first
step to investigate this, set a breakpoint on the line

DoCmd.OpenForm stDocName, , , stLinkCriteria

Then trigger the procedure by clicking the button. When code
execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate window
in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of
stLinkCriteria
should be displayed. Copy and paste that into a reply to this
message,
so I
can see if there is anything odd about it. Then return to the VB
editor
and
press F5 to let the code continue, and confirm that the error was
raised
as
before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

David Harris

I pressed F8 instead of F5 and it then highlighted Msg Err.Description
After F8 again the error "The OpenForm action was cancelled" appears.

Yes when trying to open the form from the form list nothing happens.
In Office 2003 the form does open up from the form list.

BruceM said:
I didn't mean to jump in on the thread. You referred to [Client
Reference]=1577 as the Criteria, so I thought you were referring to
something other than the string stLinkCriteria. I thought I could provide
some clarification. My apologies for the misunderstanding

I will just suggest that you press F8 instead of F5 after the break point,
so that you can discover which line of code exactly is producing the error.

Also, when you say "nothing happens" when you try to open the form from the
database window (I assume that's what you mean by "forms list"), do you mean
it sits there and doesn't even begin to open?

David Harris said:
I completed the steps and replied with the following.

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I click
the
button.
After pressing F5 th same error comes up.

BruceM said:
Dirk suggested a very specific course of action. How did that go? Are
you
clear on how to set a break point and the rest of it?

If you are unclear about setting a break point, open the VBA editor.
Click
the vertical bar to the left of the line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

A red dod will appear in the vertical bar, and the line of code will be
highlighted. Click the button to run the code. It will stop at the
selected line. From there the instructions should be self-evident.

Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I
click
the
button.

After pressing F5 th same error comes up.

Regards,

David

:

message
I opened the Personal Details page and instead of clicking on the
button
I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.


That leads me to believe that there is a problem with the criterion
being
specified in your Open1stAccessCourse_Click() event procedure. As a
first
step to investigate this, set a breakpoint on the line

DoCmd.OpenForm stDocName, , , stLinkCriteria

Then trigger the procedure by clicking the button. When code
execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate window
in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of
stLinkCriteria
should be displayed. Copy and paste that into a reply to this
message,
so I
can see if there is anything odd about it. Then return to the VB
editor
and
press F5 to let the code continue, and confirm that the error was
raised
as
before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
B

BruceM

I expect you are saying it went to the MsgBox Err.Description line after the
OpenForm line. I would try removing the Where argument, and just open the
form, to see if the error is with the Where or with the action of opening
the form.
Although I have Access 2007 at home I am not very familiar with it yet, so I
will step out of the discussion for now and see if Dirk comes up with
something. Sorry if I have muddied the waters.

David Harris said:
I pressed F8 instead of F5 and it then highlighted Msg Err.Description
After F8 again the error "The OpenForm action was cancelled" appears.

Yes when trying to open the form from the form list nothing happens.
In Office 2003 the form does open up from the form list.

BruceM said:
I didn't mean to jump in on the thread. You referred to [Client
Reference]=1577 as the Criteria, so I thought you were referring to
something other than the string stLinkCriteria. I thought I could
provide
some clarification. My apologies for the misunderstanding

I will just suggest that you press F8 instead of F5 after the break
point,
so that you can discover which line of code exactly is producing the
error.

Also, when you say "nothing happens" when you try to open the form from
the
database window (I assume that's what you mean by "forms list"), do you
mean
it sits there and doesn't even begin to open?

David Harris said:
I completed the steps and replied with the following.

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I
click
the
button.
After pressing F5 th same error comes up.

:

Dirk suggested a very specific course of action. How did that go?
Are
you
clear on how to set a break point and the rest of it?

If you are unclear about setting a break point, open the VBA editor.
Click
the vertical bar to the left of the line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

A red dod will appear in the vertical bar, and the line of code will
be
highlighted. Click the button to run the code. It will stop at the
selected line. From there the instructions should be self-evident.

message
Hi,

The Criteria returned was [Client Reference]=1577
This is the reference number for the prson's record I am on when I
click
the
button.

After pressing F5 th same error comes up.

Regards,

David

:

message
I opened the Personal Details page and instead of clicking on the
button
I
tried to open up the form directly from the Forms list.
Nothing happens, No error message.


That leads me to believe that there is a problem with the criterion
being
specified in your Open1stAccessCourse_Click() event procedure. As
a
first
step to investigate this, set a breakpoint on the line

DoCmd.OpenForm stDocName, , , stLinkCriteria

Then trigger the procedure by clicking the button. When code
execution
halts at the breakpoint, press Ctrl+G to bring up the Immediate
window
in
the VB editor, and enter this in the Immediate window:

?stLinkCriteria

When you press the Enter key after that line, the value of
stLinkCriteria
should be displayed. Copy and paste that into a reply to this
message,
so I
can see if there is anything odd about it. Then return to the VB
editor
and
press F5 to let the code continue, and confirm that the error was
raised
as
before.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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