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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report style based on specific field? 2

Status
Not open for further replies.

sedixon

Technical User
Apr 15, 2002
12
US
I have a database that contains literature references. The references can be anything from magazine articles, to books, to videos or conference proceedings.

I have a form the user can use to search the database for the area of research they want. The report is built off the query that used to search.

Is there a way to change the style of reporting based on the media type? For example, the MLA style for books is much different from the MLA style for videos or websites. Would I have to use IF statements to distinguish between the different media types?

Thanks!
Sarah
 
Assuming that you have all the necessary report types/styles already created, you can set that filed's AFTER UPDATE property to:

Dim vMedia As String

vMedia = FieldName

Select Case vMedia
Case "BOOKS"
DoCmd.OpenReport "rptBOOKS", acViewNormal
Case "VIDEO"
DoCmd.OpenReport "rptVIDEO", acViewNormal
End Select

Hope this helps.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Doing that way would mean I would have a different report for each media type, right? Could I combine all the reports into one large report? If so then all the "books" would be in one section and all the "videos" in another. That might work provided I can combine all the individual reports into one large one.

I think I was originally aiming more for one report with a bunch of different styles in it. Kind of like a bibliography. Which is really what the office wants. Any idea on how to do that?

Thanks for the help!
Sarah
 
Sarah:

Yes, this would mean that you would need a report for each style, but then you could also create a MASTER report with all the different style reports in that report. This is called a sub-report.

Check out the online information in Access about sub-reports...it's very flexible.

Jim
"Get it right the first time, that's the main thing..." [wavey]
 
Jim,

Thanks so much! The way you suggested sounds like a much more logical approach than what I had originally thought I wanted to do! I had completely forgotten about sub-reports. Thanks for jogging the memory!

Sarah
 
Sarah:

You're very welcome! Always glad to help.

Jim [wavey3] "Get it right the first time, that's the main thing..." [wavey]
 
What does the prefix "ac" indicate?

As in acViewNormal

Thank you.

rccline
 
Most Access "methods" have strict syntax and required arguments. In most of these, there are "intrinsic constants" that begin with "ac". I really don't know what it means. Sorry.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Most Access "methods" have strict syntax and required arguments. In most of these, there are "intrinsic constants" that begin with "ac". I really don't know what it means. Sorry.

Check out the OpenReport method and the PrintOut method to see a list of each "ac" constant associated with each method.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Thanks. The book I am using (MSAccess 2000 VBA Fundamentals) doesn't go into much explanation. It says, in an example, "What follows the GoToRecord 'Method' are its 'agruments' Then in the example routine, I see DoCmd.GoToRecord . . acNewRec

I don't know what NewRec is. It is a constant I presume. In another example, the author sates:

If FilterType = acFilterByForm Then

I don't know what is simply a naming convention and what is a label for an object, method, or comand. This book gives an attempt to describe these things but I can't find a tree that describes all the variables indicated by these labels.

Do you have any recommendations where I might find a good reference that sets these things out?

Thank you.

rccline

 
Naming conventions are important to follow. I personally don't use them all myself, but enought to help me distinguish between a variable I've created, or a form, or a table. If you have a table name DOCTORS, a query named DOCTORS, a form named DOCTORS, etc., Access won't know which of these you're trying to open.

Minimally, I preceed tables with "tbl", reports with "rpt", queries with "qry", macros with "mcr" and modules with "mod".

You can get much more detail from these links:



Have fun!

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top