Re: OpenForm Action Cancelled
From: Jan Il (abuse_at_localhost.com)
Date: 11/28/04
- Next message: tina: "Re: Conditional Expression Help Needed!"
- Previous message: Dirk Goldgar: "Re: [OT] My help files are not opening properly, how do I correct this."
- In reply to: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Next in thread: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Reply: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 28 Nov 2004 17:45:12 -0500
Hi Dirk! :-)
> "Jan Il" <abuse@localhost.com> wrote in message
> news:O9CrbTZ1EHA.824@TK2MSFTNGP11.phx.gbl
> > Hi all - Access 2002 XP, W2K SP4
> >
> > I have a form for which I have a unbound combo box with a command
> > button with the following code, that opens a Record form with the
> > respective data selected in the combo box.
> >
> > Private Sub cmdCardAcctNum_Click()
> > On Error GoTo Err_cmdCardAcctNum_Click
> >
> > Dim stDocName As String
> > Dim stLinkCriteria As String
> >
> > stDocName = "frmCreditCardReg"
> >
> > stLinkCriteria = "[AcctNo]=" & "'" & Me![cmbCardAcctNum] & "'"
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> >
> > Exit_cmdCardAcctNum_Click:
> > Exit Sub
> >
> > Err_cmdCardAcctNum_Click:
> > MsgBox Err.Description
> > Resume Exit_cmdCardAcctNum_Click
> >
> > End Sub
> >
> > When I make a selection from the combo box and then click the command
> > button, I am getting an error message that says: "OpenForm action was
> > cancelled". No reason why, or any other information in the error
> > message.
> >
> > This happens for all 6 of the command buttons on the form. One of the
> > command buttons just opens the Record form with all the records, so
> > there's no combo box or other action control that is used in
> > conjunction with it. I have used this process many times before, and
> > never gotten any error message. I have checked all the control and
> > form names and they are correct as written as far as I can see.
> >
> > I have tried to look this error up and so far have not found any
> > explanation for it. I would truly appreciate it if someone could
> > explain what this type of message means so that I will have a better
> > idea of how to troubleshoot the problem.
>
> Hi, Jan!
>
> I've seen this happen when some error occurs in opening the form.
> Normally I'd ask first about the validity of your criteria string -- for
> example, if there's no field named "AcctNo" in the form's recordsource,
> or if it's a number field and not text (since you're wrapping it with
> quotes). But since you tell me that you get the same error when you
> click a button that just opens the form with no criteria, that seems to
> rule out the "bad criteria" option.
>
> First question: can you open the form itself without error by
> double-clicking on it in the database window?
Yes, I an open the form itself by double clicking without any error. Also,
there is a field named AcctNo and it is a number field.
>
> Second question: if you can't, can you open the form's recordsource
> (query or table) by double-clicking on it in the database window?
I can do this as well....no errors
It seems to be related to just the filter form. The code for 5 of the
command buttons is basically the same as what I posted here, with just the
change in criteria. The sixth one, that just brings up the form with all
data, has this code:
Private Sub CmdCreditCardReg_Click()
On Error GoTo Err_CmdCreditCardReg_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCreditCardReg"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_CmdCreditCardReg_Click:
Exit Sub
Err_CmdCreditCardReg_Click:
MsgBox Err.Description
Resume Exit_CmdCreditCardReg_Click
End Sub
As you can see, it does not call for any specific criteria.
Here is the query SQL for the Record form:
SELECT MyCreditCardRegister.CreditCardID, MyCreditCardRegister.CreditCardNo,
MyCreditCardRegister.TransactionDate, MyCreditCardRegister.CardCompany,
MyCreditCardRegister.PurchasedFrom, MyCreditCardRegister.PurchaseAmt,
MyCreditCardRegister.PaymentAmt, MyCreditCardRegister.TransactionType,
MyCreditCardRegister.Comment, MyCreditCardRegister.TransactionSign,
MyCreditCardRegister.AcctNo, MyCreditCardRegister.BeginBal,
[Forms]![frmCreditCardRecFilter]![TxtDate1] AS Expr1,
[Forms]![frmCreditCardRecFilter]![TxtDate2] AS Expr2
FROM MyCreditCardRegister
WHERE (((MyCreditCardRegister.TransactionDate) Between
[Forms]![frmCreditCardRecFilter]![TxtDate1] And
[Forms]![frmCreditCardRecFilter]![TxtDate2])) OR
((([Forms]![frmCreditCardRecFilter]![TxtDate1]) Is Null)) OR
((([Forms]![frmCreditCardRecFilter]![TxtDate2]) Is Null))
ORDER BY MyCreditCardRegister.TransactionDate DESC;
Thank you for your time and help, I really appreicate it. :-)
Jan :)
Smiles are meant to be shared,
that's why they're so contagious.
- Next message: tina: "Re: Conditional Expression Help Needed!"
- Previous message: Dirk Goldgar: "Re: [OT] My help files are not opening properly, how do I correct this."
- In reply to: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Next in thread: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Reply: Dirk Goldgar: "Re: OpenForm Action Cancelled"
- Messages sorted by: [ date ] [ thread ]