Report using macros and forms

nsohenick

Registered User.
Local time
, 20:08
Joined
Jul 18, 2003
Messages
24
I am trying to add a report to an existing database. I use access for mostly Data Conversion so I am not familiar with the report section. I am trying to copy a report, but use a different field for criteria.

I copied the existing report that uses the same fields, but different parameters. I also copied the query and chose the department field as the new field for criteria (This is what the report is pulling it's data from).

The original report uses a form to receive the parameters from the user and macros are used to initiate the the form. It is based of a query. So I created a form for the department parameter and created new macros for the new form and copied the query changing the criteria parameter to department number.

The form works fine and is a drop down list of department numbers. For the most part the macros work fine, such as OK and Cancel. But when clicking OK. It is supposed to take the Department number and use the SetValue function to use in the report. That does not work. The report comes up blank.

My query however does work when not using the form. I get the generic pop-up asking me for the department number. I type it in a the query shows all records for that dept.

What am I doing wrong?? I am lost.


Much appreciation for any advice!!

Nsohenick
 
How do I get to that?
 
Go into the design of your form and right click on the ok command butto. Go into properties and choose the event tab. What is under the onclick event?
 
ok when you copied over everything, is this still referencing the previous name perhaps? This might be causing your problem.

I've attached an example for you to have a look at.

HTH
Hay
 

Attachments

Well I don't receive any error. I just get a blank report. I can't help but to think that the setvalue function is not linked correctly. There must be something behind the scenes that I missed. I changed everything that I saw from the original report, form and macro references to the new references. Is there something else I need to look at?

Thanks

Nsohenick
 
I can't

I exported the needed items and cut down most of the data, but the size is still to large to post.
 
Ok think I've solved it for you - here's hoping anyway. It looks as though the problem lies in your query. Spelling Error in your combo name. I've sent your db back to you.

Let me know if that is ok.

Hay
 
Yes. That worked. Although I am getting those error messages. I saw that I had [Forms]![Dept # Dialog Box]![Deptartment Codes] in the criteria area. I changed it to Department Codes and again nothing shows in my report.

I also changed it to any DeptNo which is what is shown right above the Dept Codes in the drop down and that didn't work. It seems to work better with the misspelled fieldname???

What did you do to get it to work?
 
The reason why it works with the misspelled fieldname is because you are looking to the combobox name on your form and you have that spelt wrongly, therefore spelling it correctly in your query is not picking up the values because the two don't match.

HTH
Hay
 
I see where I have it misspelled. I am getting an error on the open report macro. When I run the report I get: "This action can't be carried out while processing a form or report event." Then I click ok and get, "Action Failed"

Macro Name: openreport
Condition: Ture
Action Name: OpenReport
Arguements: Search By Department #, Print,,,

I click halt, then the report shows up fine.

If I go to the openreport macro and double click I get, "You entered an expression that has an invalid reference to the property visible. The proprty may not exist or may not apply to the object you specified."

Macro Name: openreport
Condition: True
Action Name: Setvalue
Arguments: [visible], no

I looked through the expression builder of the macro and visible wasn't an option. I didn;t see anything that could take its place... Is there another property we could use?

Thanks
 
Can I just ask if you had any problems with the database I sent you back? I didn't experience any problems with this > no error messages, everything was running fine. Did you just copy everything over from the sample to your own db? Is the openreport macro assigned to your ok cmdbutton?
 
I get it from the one you sent back to me. Without changing anything.
 
Just picked up your email this morning as you sent it to my work email and not the one above, anyhow I've opened it and ran the report and it all works perfectly - I can't understand why it's not working for you.
 
I will try it on another computer tonight and see what happens. The db is in 2000. I'll back it up and upgrade the db and see if that helps...
 
I was able to get the report running. I changed the macro to run on open to the "Department # Dialog Box Macro.OK" macro and it worked without the error.

Is it possible to ask for 2 parameters in the report such as date range? I already have the form and macros set up for another report can I add it in to the Dept Search report?
 

Users who are viewing this thread

Back
Top Bottom