Microsoft Access unable to display image attachment (Runtime Error 2220) - image

I have a table called "Subsidiary Companies" where I store the names of different subsidiary companies and their corresponding company logo images as an attachment in a table.
I have a form called "invoice" where I use it to generate invoices. Whenever I select a subsidiary from a Combobox, it will change the image attachment box on my form to the one corresponding to the company selected.
After I attach the image to the table it worked. When I closed my entire access program and went back to it, it doesn't work anymore even though I did not change any codes, settings or image path. I got an error instead, "Runtime Error 2220: Microsoft Access can't open the file image.jpeg".
Here is my code to select the attachment image based on the company selected:
Me.AttachmentCompanyLogo.DefaultPicture = Me.ComboboxCompanySelection.Column(1)
Not sure where it went wrong as I am not very familiar with Access, would appreciate some help, thank you :)

based on this statement: " When I closed my entire access program and went back to it, it doesn't work anymore"
that behavior would occur if you failed to also include the primary/foreign key cross reference value in the record. such that when you next go to select it - it can't be found because when you added the image/path it also needed the key value as a cross reference...
this is just a guess of course...
look directly at the table and see if this data is missing...
on a different topic; if you have only a small quantity of images the use of attachments is ok however if there will be a larger quantity then one should not use the attachments feature and instead store the image docs in a separate folder while putting the path to the image doc in a table.

Related

Can I have more than one attachment open at a time? Access/Oracle BLOB attachments

Good day all,
Problem: Users cant have more than one attachment open at a time.
Goal: Provide a way for users to have more than one attachment open at a time.
Set up: Win 10, MS Access Ver. 2112 (should be latest version as of post date), split FE/BE, Oracle 11g2.
Operation: Users create a record via a main form. Each entry represents a task to be carried out. The main form, contains a sub form that allows multiple attachments to be saved per record. The subform is a linked table from Oracle, connected through ODBC, and the column storing the attachments is BLOB. This functionality is working great.
Situation: Some of the processes that users carry out require management review. This means that a manager will pull up the record in Access and begin opening the attachments. Because some of the review processes require comparison of the attachments, it has become problematic because only one attachment can be open at a time.
Example: A record contains an attachment in the subform. Left click only attempts to edit the thumbnail that has been automatically placed in the field. Instead, a user will right click->document object->Open. This will open the attachment in whatever program the users desktop has associated with that file type. In this case, let's assume that the file is a MS Word doc. MS Word will open with the document. Everything functions as it should until the user right clicks on the next attachment to open it. This causes the Word doc to close, leaving MS Word open but with no document displaying.
Note: While the MS Word attachment is open, in the upper left hand corner, the words "Document Saved to this computer", with a combo next to it can be seen. Clicking the combo reveals that the document has been given a temporary name and is being temporarily held in the Word program folder in App Data.
Clunky work around: At this time, the only option for the users is to open the attachment, save it to a local folder, and repeat for each attachment. Once all the attachments are all saved, the reviewer can go about their business. This was problematic enough for users to inform me about their dissatisfaction with the functionality. I know, shocking. lol
Help!: What I'm seeking are suggestions and methods for either making it work in the way the users need or for some sort of work around, like, coding for access to gather and save all attachments to a given location.
If you read this far, thank you.

MS Dynamics CRM 365 - import data from Excel files

I'm getting into MS Dynamics CRM 365 programming, and have been dealing with data imports of lookup / reference entities.
I created a new entity with just the default Name column, stored and published it, and then went to look at in CRM. From the default "main" view, I choose the "Data Import" option and downloaded a template .xlsx file, which I then filled out. After that, I chose "Import Data" and uploaded this filled out .xlsx, and it was submitted, parsed, transformed successfully and the rows I had entered show up as expected.
So far, so good.
Now I created a second lookup entity (again with just the Name field), published it, and thought I'd be smart and just "re-use" that .xlsx "template" I had downloaded for the first lookup entity, and enter the new values for the second lookup entity, and then upload this manually "recycled" file. I did change the file name of the .xlsx, as well as the worksheet name, to match the name of the second lookup entity.
And while the upload, the parsing and transforming worked just fine - the actual rows I had inserted ended up in the first lookup entity...
So my conclusion is: somewhere, CRM must keep track of what entity that .xlsx was indended for - and it's neither the file name of the .xlsx, nor the name of the worksheet (which I had also updated) - it must be stored somewhere else.
Does anyone know where?? Can I change it somehow (manually or programmatically)?
After I went through the full cycle again (download import template .xlsx, fill that out, upload that file) - it works just fine for the second lookup entity, too.
There will be a hidden sheet in Excel file, but we cannot unhide it. That’s where all the configurations are stored.
But you can see it when you do something like explained in this blog, you have to click “View code” option from context menu, by right clicking sheet name tab in Excel file.
Then by opening the “Project explorer”, the hidden sheet will be visible in VBA, set the visibility to 1 – xlSheetVisible. Don’t save anything.
I believe the issue lies in the hidden first three columns, the first of which contains the entity name in the header.
When working with import templates, especially when exporting for reimport, these columns are key. The first column holds the Guid of the record, the checksum tells the system if the user touched the data in the row, and the modifiedOn allows the system to know if the data was changed in the system after the export.

Microsoft Access 2013 VBA code changes bound control on change of record am getting write conflict

Have just got back into coding in Microsoft Access, so it might be something stupid.
Situation:
Sqlite database linked to Access db via ODBC.
Have created a form which has bound controls from a table.
Due to the way sqlite stores dates, as text, I am not able to use the calendar picker. I thought easy I can create an unbound text box control, set the format to date and then I will have a date picker. Then in VBA just get it to change the value of the bound date control, which would be hidden.
Me.txt_Date_of_birth.Value = Format(Me.Txtdate_of_birth_with_calandar_control.Text, global_date_format)
It works it changes the value of the bound control (which for testing is not hidden).
But when I change records I am getting an error of
Write conflict. This record has been changed by another user since you
started editing it. If you save the record, you will overwrite the
changes the other user made.
From my testing it is being caused by this unbound control updating the bound control. Anyone know a simple fix?
And I would prefer not to get my data from a query that formats the text field into a date field.
And I can confirm that the error does not occur when I create an access table and try to update a bound control.
Try saving the record at once:
Me.txt_Date_of_birth.Value = Format(Me.Txtdate_of_birth_with_calandar_control.Text, global_date_format)
Me.Dirty = False
Does this table have a primary key? - in the eyes of Access - by which I mean when you look at the table in design view with Access.....
If not try adding that.

turbogears querying the database for file

I am using the Turbogears-2.3 framework and now I know how to upload the files in the database using the tgext.datahelpers. I understand that the file gets uploaded in the disk and in the database the metadata gets stored in the JSON format. Now I want to query the database and wanted that the link to get generated in the file collumn so if someone clicks on it then the file can get downloaded. However when I tried to query the database and viewed the table, in the file column I get text like trai.model.model.F_AttachedFile object at 0xa7325bac (trai is the name of the project).
When I iterated through the table and printed the value of the element in the javascript console, the same thing is getting printed. Could anyone please tell me how to generate the downloadable link from this.
Thank you very much
Not sure that I full understood your question, a little snippet of code might have helped understanding the context, but if I guessed correctly you are trying to the the url of a tgext.datahelpers uploaded file.
In such case see https://bitbucket.org/axant/tgext.datahelpers#rst-header-attachments each attachment Column provides an url property, so you can get the URL from there.
There is also an example that saves and Document model with a file field and queries it back printing the url.

Current version of data in database has changed since user initiated update process

I have a Master Detail form in my Oracle APEX application. When I am trying to update data in this form, I am getting below error.
Current version of data in database has changed since user initiated
update process. current row version identifier =
"26D0923D8A5144D6F483C2B9815D07D3" application row version identifier
= "1749BCD159359424E1EE00AC1C3E3FCB" (Row 1)
I have cleared browser cache and try to update. But it not worked.
How can I solve this?
I have experienced similar problem where my detail records set has timestamp fields. By default master detail wizard creates the timestamp fields as date picker type fields. If you set the date format on these, it would resolve the issue.
This blog post tries to address this issue on a Tabular Form (I know that's not what the original issue was with, but thought it might be related). It says the same as #sangam does below.
Short version: If you have an updated field that's timestamp datatype, you should set a date/time format.
http://apexbyg.blogspot.com/2015/05/tabular-form-bug.html
My tabular form has a field that's timestamp datatype, but I had already set a date format, so this didn't help me.
Here's another possibility, which I discovered was the case in my application.
That would be if the data the original checksum was calculated on is truly different than the pre-update checksum calculation, due to a design-flaw in your query!
In my application, the source for one of the updateable fields was COALESCE(name_calced, name_preferred). In the source table, the person's name could already be loaded in the record by an external process and we save it to one field - name_calced. But the end-user can enter a preferred name, which we wanted to save to the name_preferred field. We wanted to initially populate the displayed, updateable tabular form field with name_calced, if one existed, or name_preferred if the user had already provided a preferred name. Then they could change that value and save it back to the database.
I finally discovered that the Save action threw the error message if name_calced was non-null, but name_preferred was null. I realized that the initial checksum was calculated based on name_calced, but the pre-update checksum was based on name_preferred, so the application thought someone had changed the value in the background and showed the error message.
What I don't understand is how this problem didn't show up in the past 3 years the application has been running in production!
My solution is to make the field source only on name_preferred, which immediately solved this problem. I also think the back-end process will also get changed to pre-populate that table field from name_calced, so the user always sees the base value, if there is one.
I just had this issue myself. Now, I realize that tabular forms are deprecated at this time, but I have an application that was developed beforehand and still uses them. This issue occurred and I had to get one of our big guns at Oracle to help me out. I do a lot of DB work and a decent amount of Apex development but I'm more of a Java, WebLogic, etc guy, and I really couldn't figure this one out.
In my case, it turned out to be really simple. One of the columns in my tabular form was a hidden field, generated via a sub query. Being hidden, this column is not editable by the user and should not be part of the MRU update. I had the field set to "Hidden Column (saves states)" and setting its type to "Hidden Column" fixed the issue. So, this leads to sub queries being executed in such a way as to change the checksum for the overall query before hitting submit (save), causing the error.
For those who are continuing to troubleshoot this, look at your query for every field that you have specified and note which columns are editable in the tabular form. All other fields should be set in a way that makes them not save state so that they are not part of the update.
I had this error when I had two update processes processing on submit.
My solution was to add a condition to both processing steps. I had forgotten to do this when I made an additional process for Button A, but I never updated Button B to limit it's behaviors.
Navigation:
Processing -> Processes -> [Your Process Name] -> Server-side Condition -> When Button Pressed = [Your button Name]
In my case I had a column from a secondary table that was not set as Query Only and was being updated! The error would occur trying to save a column not in the table being updated. It took me half a day to figure it out (the column names were the same).
Set your Link column hidden to display only in the form.
Set "Send On Page Submit" to 'No' or disable the link column that is your primary key ( Rownum/rowid/id etc).
Hope it will work for you.
I have noticed this error comes when I was working Tabular Form and has disabled one of the form operations i.e. by setting server-side condition to "Never" for add, apply changes (submit) buttons
When I have restored back to its original state, it worked as expected.
In case you have to hide Add/Update button, use some other option.
https://compknowledgebase.blogspot.com/2018/12/oracle-apex-error-current-version-of.html

Resources