Hello all ye smart ones! This could be a difficult one, at least is beyond me.
I have a skills certificates database in which I use for campers who have passed various levels of various skills. The office enters the camper's name, skills, levels passed etc, and then the code uses that information to build a report that places the applicable sticker (image) onto the proper place on the card. All the information and images on each certificate is completed by code. It works well... except...
This year, when trying to use it, none of the images printed. So I have been looking for the reason... thinking it to be a broken code or corrupted system. But code seems to be good, and it worked before. Also all the images display on screen for me, but not when I print.
So I started to consider what might have changed. And here is the kicker... I am using a new computer, which means the computer name is changed, meaning that none of the directories built into the system work. When I loaded the project the first time, I had to change some file pathways. And yes, then it began to work, until the print.
I can move around the various forms and work the various buttons quite well. But I wondered about the images and opened the report design, then tried to select "Insert Image" and that causes the system to run something in the background, the wait circle comes up and rotates for a while, and then crash. It can be repeated over and over, but only in that particular database. My guess is that all the hundred or so pathways of images that are somehow loaded and saved inside the system, are wrong, and as a result the system spends some time trying to locate them, and then overdoes the RAM or something and crashes. Access closes, and sometimes tries to reopen on its own.
So here is the question...
Is there a way to build a code that changes those file pathways? Or a simple way to get in?
My only other solution is to start a new database and to import all the forms, tables and codes, and then to manually insert each one piece by piece.
Hi, I can provide or develop the code, but have you tried manually changing one and then using it in a new report along with the old path to see if it actually resolves the issue?
I can't do it with the Insert Image tool, as that causes the crash. [Hesitates, starts the circling image, "Access not responding" appears on top bar, crashes, restarts Access]
So I did it with the Controls, Image tool. The print showed again with no image, though I had place the image on top of everything and where the image would be the text is as though it is hidden by the invisible image.
I would normally copy/cut the code behind an offending form or report or query, then paste that code into a Notepad so as to remove any hidden junk (I was guessing). Then I would copy the code from Notepad and paste it back in the vba platform. That has in the past solved issues for me. It is a nice trick. But I don't see how it will work here, since the Insert Image causes a crash in every form on the Skill Certificates database.
I opened a different database and Insert Image works fine.
Maybe there is a way to view code behind the other parts of the database... I would try that for those? Notepad is a great tool as it doesn't copy anything except basic text.
The other solution is to start a new database and to import tables, forms, reports, data from the old one. That may be easier than writing a bunch of code to fix something when we don't know if that is the issue. This isn't a very large database, and it is basically quite simple. And I also erase all records after the summer since I don't need the data after that. Currently I only have 93 records on one table and 4 on another.
It doesn't take long to import the data in to a new database, so that is definitely worth trying.
I use VBA to dynamically insert the Image at the formatting stage of report printing.
OBP, I did so. I then opened the new one and the print is still without images. So I went back to the certificate in design view, and now I am able to insert image without crashing. One problem solved.
But after inserting the background image, I tested by print preview, and no background image... sigh. The image is set to "Display when" = Always. And the printer does not have data only checked. I don't understand much about how images work. I know that as soon as I imported the tables, forms, queries, and functions from the other DB to this one, and viewed the certificate (which I see is a form - I did it back in the day before understanding reports), the form view showed the images, but the print view does not.
Is that due to bad pathway referencing? I mean if the path is wrong then why would it show in form view at all. It shouldn't show at all, am I not correct?
It would mean then that there is another problem somewhere that didn't show up before. Another change is that I moved from Access 2007 to Access 2016. Could that have done something?
Finally, do I have to import an image for every placement it would show up in, or just once. The image for fishing skill can go in any of three locations. I would suppose one insert should be enough. Is that correct?
Gary, are you actually importing the image in to a table or referencing the original file via a file path in the table.
I use dynamic insertion of image the by referencing the original, which is the old fashioned way to do so.
I will find an old database that does this.
All my old photo printing databases were too large to post on here, so I created a simple one to demostrate what I am talking about.
The zip file contains the 2 photos that I have used, one is also the "place holder" for the image when it was created, the VBA changes it for the second record. You can change the first record and it will also change the image.
There is the code in the Form's "on Current" Event and also the the Report Detail "On Format" Event as well.
You will of course have to put them in your Folder and change the File Path to suit.
So it will crash when you open the database because the form can't find the Photos until you add them to your folde and also change the file paths in the File Paths Table.
As to your first question, I am not even sure. I didn't even consider the idea about using a table. I think that might work a lot better for me as I used a lot of code to determine which sticker to use as an image, based on the value given by the skill instructor and stored in the camper table.
All I did was to use the Insert Image button, place the image, and save. So the image would not be in any table, just remembered by the program somehow. I imagine it builds its own internal library somehow.
So are you saying that by using the table for filename and path, and using code, I won't need to insert any image?
The nice bits about this approach in my view as a student...
1. It doesn't rely on any internal memory, but the info is retrieved from a table each time
2. It allows the user to change any paths as necessary (i.e. when a file folder names are changed).
Anyway, that is a big change for me for a future date, as I need this working now if possible.
I found another suggestion to change the size mode of each image from Zoom to Stretch, which I have now done, and it is working in Print Preview. Perhaps that means it will print on cardstock now as well. If so, I will set the rest of this aside til fall. If not, then I will be back tomorrow. :S