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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Form_open Cancel question
Hi,
i've got a form where i'm calling another form with Docmd.Openform now in the form i'm calling, in the form_open, i'm testing a few conditions. Only if the conditions are met the form should open. so when the conditions aren't met i say Cancel = True But then in the calling form i get an error, saying that opening the other form was cancelled. Which is logical, since i cancelled it. However, i don't want that error, i just want te form not to open if those conditions aren't met. Any ideas on this? Thx in advance! Thomas L. |
#2
|
|||
|
|||
Form_open Cancel question
Add error-handling to the procedure that contains the OpenForm.
Trap and ignore error 2501. Example: Private Sub OpenMyFOrm_Click() On Error GoTo Err_Handler DoCmdOpenForm "Form2" Exit_Hander: Exit Sub Err_Handler: If Err.Number 2501 Then MsgBox "Error " & Err.Number & ": " & Err.Description End If End Sub More on error handling: http://allenbrowne.com/ser-23a.html -- 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. "Mr. T." wrote in message ... Hi, i've got a form where i'm calling another form with Docmd.Openform now in the form i'm calling, in the form_open, i'm testing a few conditions. Only if the conditions are met the form should open. so when the conditions aren't met i say Cancel = True But then in the calling form i get an error, saying that opening the other form was cancelled. Which is logical, since i cancelled it. However, i don't want that error, i just want te form not to open if those conditions aren't met. Any ideas on this? Thx in advance! Thomas L. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exam question wrong about Word? Opinions, please! | Jamie Furlong | New Users | 6 | April 18th, 2006 11:56 AM |
Cancel still adds record | Tee See | New Users | 22 | February 8th, 2006 11:40 PM |
Search my question lost in the long list | Shrikant | General Discussion | 3 | August 26th, 2005 09:32 AM |
MVP Question (database Design & Server Requirements) | rayrock | Database Design | 3 | August 12th, 2005 02:45 AM |
database design question | e-mid | Database Design | 9 | June 16th, 2004 09:42 PM |