A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Attn Graham Seach - Runtime error 2501



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2004, 12:37 AM
Lurch
external usenet poster
 
Posts: n/a
Default Attn Graham Seach - Runtime error 2501

Hi Graham;

Thank you for replying to my question regarding "Opening a form based upon
two fields".

You were right about the fields being strings. I tried your example but now
I get a Run-time error 2501 Open form was cancelled...

What could be causing this?

Thanks


  #2  
Old May 26th, 2004, 03:56 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default Attn Graham Seach - Runtime error 2501

Firstly, next time, rather than starting a new thread, please continue using
the existing one.

Try using the Nz() function:

DoCmd.OpenForm "frm_Form2", , , "Nz([field1], '') = """ & _
Nz(Forms!Form1!Field1, '') & """ And Nz([field2], '') = """ & _
Nz(Forms!Form1!Field2, '') & """"

I don't think nulls are the problem, but I want to rule them out. If this
doesn't resolve the issue, you must have some code in the form's Open event
that sets Cancel = True. If that's the case, you need to place "On Error
Resume Next" just before the DoCmd.OpenForm line.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"Lurch" wrote in message
. ..
Hi Graham;

Thank you for replying to my question regarding "Opening a form based upon
two fields".

You were right about the fields being strings. I tried your example but

now
I get a Run-time error 2501 Open form was cancelled...

What could be causing this?

Thanks




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.