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

Choosing Records to display on a report in VBA 1

Status
Not open for further replies.

xhonzi

Programmer
Jul 29, 2003
196
US
This is hopefully very simple.
What I'm trying to do s generate a report of missing pictures. The pictures are named uniquekey.jpg if you know what I mean. I've written the VBA code to test whether the file exists... but now I need to know how to determine whether the record is displayed or not. Is there something along the lines of

If blah blah blah then
this record.shown = 0
end if

Or what is the best way to go about this?

Xhonzi
 
Do you really mean "whether the record is displayed or not" or code to display the record or not display the record.

Please post an example of what you have and what you want.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
The latter. Code to display the record or not display the record.

Please see the example I posted in my first post.

Xhonzi
 
If your code is a function, you can try place it in the query criteria.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
I'm not quite sure how this would work. I usually work on Forms and not reports, so please forgive my ignorance.

Let me start over:
I have a large number of records. Each record should have a picture. This picture is not part of the database, yet it is named after the uniquekey of the record and ".jpg". So, there is nothing to test on in the table to see whether a picture exists for that record. The picture is displayed on the form through a little VBA magic that is commonly passed around here at Tek-Tips. Anyhow, I know I can test for the picture (on a record by record basis) by using the Dir command. I do this in the form (which, by the way, displays records individually, unlike the report) and it works great.

Now, the only way I currently have of seeing which records have pictures is to manualy navigate the form to each record and look to see if a picture appears. Not too effective. So, I was thinking that I should be able to use a report to tell me which records test negative on the Dir command. On a form, I would use a Form_Current routine and ask that question as it loads each record. Since the report is continuous, I don't even know how to refer to each record individually. That is my first problem. And then the actual manner of showing/hiding records based on a test and probably an if->then statement.

And I don't know exactly what you mean by query criteria. If you still think that is what would be best, could you please elaborate?

Xhonzi
 
In your query, is it possible to create a column:
LenDir: Len(Dir([YourField] & ".jpg"))
Criteria: >0


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Very good. That will work. Thanks!

Xhonzi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top