Help on Form

JIT

Registered User.
Local time
Today, 06:09
Joined
Sep 11, 2002
Messages
29
Hello Friends, I would appreciate if some of you help me on these two problems about Form:

1) I have made a complaint database, where I register complaint received from customer. To know about complaint registered in a month, I have made a parameter query where I enter begining and ending dates. I have made a form (dialog box) to enter this prompt. This works well when I enter dates. However, when I close the form (dialog box), by clicking close button, a Run-time error '2501' appears with message "You used a method Docmd object to carry out an action in visual basic, but then clicked cancel in a dialog box"

2) To get the customer contact information, I have copied and used 'Customer Phone list' from MS Northwind sample database with macro, option filters and others. The contact information works well with filtered data when I press the toggle button. However, only one record appears on the form, when there are several records. I have to use bottom navigator to get other records. But when I see Northwind sample database, Customer Phone list, all records for, example, "letter 'A' " appears. Am I missing something in my code, when I copied?

Thanks in advance,

Jit
 
1. Add a breakpoint on the Close Button and walk through the code to see what line is causing the Error. It sounds to me like you are opening something and then closing it before it is finished.

2. Is your forms default view set to Single Form. If it is you may find that you will get the result you are after if you choose Continous Form.
 
Thanks Travis

Thanks Travis!

I have changed the form's default value from single form to continuous and it is showing all records.

Regarding the problem on closing dialog box, I would like to elaborate more.

I have used a form named 'Customer'. On that form I have put a label, which, when click opens the parameter dialog box form for entering begining and ending dates. On the customer form, I entered the code, "DoCmd.OpenReport "CustomerComplaint report by date", acViewPreview. The "CustomerComplaint report bye date' is a Query, which sort out the complaints by date. The debugg window points out to this "DoCmd. OpenReport...."

Travis, Thanks once again, and I would appreciate, if you can solve this one.

Jit
 
Do you use the NoData Event to stop the report from opening when there is no data?

If you do put this line just befor the Docmd.OpenReport

Code:
On Error Resume Next

Or

Code:
On Error Goto ErrorHandler

and add this just before the End Sub

Code:
Exit Sub
ErrorHandler:
  If Err.Number = 'The Error number you get when you close
    Err.Clear
  Else
    Msgbox ERROR$
  End If
 
Travis, this is the difference between an ameteur and a professional. I am a Quality Manager, and have wanted to develop a database to register customer complaints. A simple line of code, "On Error Resume next" has solved my problem.

Thank you very much and wish you all the best!

Jit
 

Users who are viewing this thread

Back
Top Bottom