Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help!! Deadline tomorrow!! 2

Status
Not open for further replies.

Talapia

Programmer
Oct 17, 2001
2
US
Hi,

I have a problem. I have a main report that is calling a secondary report. I want the secondary report to only return records from a certain catalog. So, I'm applying a filter when I'm opening my secondary report.

This is the statement I have
in the main report that is calling the secondary report.


DoCmd.OpenReport "Parts ListSubReport", acViewPreview, "[Catalog.Catalog]= " & strCatalog

strCatalog is a global variable I declared in my
Utilities script. I set it equal to a record on my main
report.

In the open report event of the secondary report I have this code:

DoCmd.ApplyFilter , "[Catalog.Catalog] = " & strCatalog

No, no matter how many variations on this I've tried
I always receive the message, "Datatype mismatch
in criteria expression."

Does anyone know why this is happening? Is there anything wrong with my logic or syntax? I'm actually supposed to deliver this to a client today and I desperately need to finish this piece.

If anyone doesn't seem anything wrong, can you make a recommendation for another way to handle this?

Thanks,
Talapia


 
Hi Talapia,

If you are opening the report like this:
DoCmd.OpenReport "Parts ListSubReport", acViewPreview, "[Catalog.Catalog]= " & strCatalog

why do you need:
DoCmd.ApplyFilter , "[Catalog.Catalog] = " & strCatalog

What happens if you take the above line out of the on_open event?

Also, have you maybe thought about adding criteria to the query that your report is based on?

Nick
 
Hi Talapia,

If the catalog is a text value then try this :

DoCmd.OpenReport "Parts ListSubReport", acViewPreview, "[Catalog.Catalog]= '" & strCatalog & "'"

Same in the filter bit as well.

HTH

Jane

 
Hi JaneC,

Thanks a ton! That worked!! You saved me!

Talapia
 
hi everyone geez im in big trouble now and i think im gonna fail my diploma course if i dont get this right. im coding a forestry management system and i need to know how to view MS ACCESS reports in vb. i got the db made and everything but can someone tell me how to somehow display the report and print it out,in detail....times running short and i really need help please !!!! :(
 
Whoops !

I think you need to repost this as a new thread !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top