By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Yet Another "OpenForm Action Cancelled" Topic

P: n/a
Hi, I've been having problems getting my forms to work correctly. If
seen other threads addressing this issue, however, these are not
working for me. The short of my problem is this. I am trying to open a
new form and initialize it with a db query based on the info in the
current form. This wasn't a problem until I changed the table's
primary key to an Autonumber. tblLockCore.lockId is the autonumber at
the source of the problem...

strQuery = "WorkstationID = '" & Workstation.Text & "' AND
tblLockCore.lockid = '" ....
[for loop that finds and appends *only one* value]
strQuery = strQuery & "'"
DoCmd.OpenForm "frmLockCore", , , strQuery

With the code above, I get the 'openform action cancelled' error. Keep
in mind there is no "Cancel = True" statement related to this code, nor
is there even a cancel button.

If I replace
tblLockCore.lockid = '...' with
tblLockCore.lockid - '...', the wrong record is used to initialize the
new form. Coincidentally it is always the first record that would be
found if the second clause was removed.

tblLockCore.lockid - ... (no quotes) *same as above*

tblLockCore.lockid = ... (no quotes) *same as above*

I believe that I have addressed the issues that I have seen work for
other people but apparently this is not good enough for my program. Any
ideas? Thanks in advance!

ps. a couple of links i had reviously read....
http://groups-beta.google.com/group/...bf46cd29f992ce

http://groups-beta.google.com/group/...730c533bc5ce63

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
A typical case of the magical computer pixies... I leave the computer
for 3 hours and come back. I try all of the combos listed above and now
tblLockCore.lockid = ... (no quotes)

works. I know what you are thinking, "He wasnt thorough before and that
was his problem." Sadly, I was quite thorough trying each one several
times. But...

At least it works now.

Nov 13 '05 #2

P: n/a
Couple of suggestions, Jeff.

This type of intermittent issue could be caused by a Name AutoCorrect bug,
particularly as you indicate that it was triggered by a structural change.
Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
More info:
http://allenbrowne.com/bug-03.html

If that is not the issue, it could be that the code fails when strQuery is
malformed. For example, of Workstation was Null, strQuery would end up
something like this:
"WorkstationID = AND tblLocCore.lockid = 3"
which is clearly not going to work.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<je********@aol.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi, I've been having problems getting my forms to work correctly. If
seen other threads addressing this issue, however, these are not
working for me. The short of my problem is this. I am trying to open a
new form and initialize it with a db query based on the info in the
current form. This wasn't a problem until I changed the table's
primary key to an Autonumber. tblLockCore.lockId is the autonumber at
the source of the problem...

strQuery = "WorkstationID = '" & Workstation.Text & "' AND
tblLockCore.lockid = '" ....
[for loop that finds and appends *only one* value]
strQuery = strQuery & "'"
DoCmd.OpenForm "frmLockCore", , , strQuery

With the code above, I get the 'openform action cancelled' error. Keep
in mind there is no "Cancel = True" statement related to this code, nor
is there even a cancel button.

If I replace
tblLockCore.lockid = '...' with
tblLockCore.lockid - '...', the wrong record is used to initialize the
new form. Coincidentally it is always the first record that would be
found if the second clause was removed.

tblLockCore.lockid - ... (no quotes) *same as above*

tblLockCore.lockid = ... (no quotes) *same as above*

I believe that I have addressed the issues that I have seen work for
other people but apparently this is not good enough for my program. Any
ideas? Thanks in advance!

ps. a couple of links i had reviously read....
http://groups-beta.google.com/group/...bf46cd29f992ce

http://groups-beta.google.com/group/...730c533bc5ce63

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.