MS Access run time error 438 on load event - ms-access

I am trying to display logo on MS Access report header. I am using table with the name of Portfolio with contain my ID, Logo fields. After upload image in this table now on report header I added the Image unbounded frame with the name of AutoImage. Now then on load event of report when i call this function it give me error.
Private Sub Report_Load()
Me.AutoImage.Picture = DLookup("[Logo]", "Portfolio", "[ID]=1")
End Sub
The erro is:
MS Access run time error 438 Object does not support this property or method.

Thanks its working now. I was using image Object Frame. This was my mistake, i just replaced Object frame with Image. Now it working.

Related

Solution for ms access invalid IDA error 7879

I've made an Access database with a connection to a DWH table. A form with 3 drop-down boxes is made for the user to select the correct value. But the first time a drop-down value is selected the user receives an error (in Dutch). 'An invalid IDA has been passed to Microsoft Access error handling. Please report this error and the steps that caused it.'
After clicking 'Ok' the error doesn't show up when selecting a value form the second drop-down box (and the third) in the same form. Only when the user selects this form again the error pops up when selecting the first drop-down value.
The only VBA code linked to this form is:
Option Compare Database
Private Sub Form_Load()
Me.AantalVanCONTRACT_NUMBER.ColumnWidth = 1.556 * 1440
End Sub
The strange thing is that the form works fine because the selected value gets inputted in the DWH table, but getting this error every time is pretty annoying.

Label Hyperlinks on MS Access 2013 Reports

I am having troubles with being able to click hyperlinks on reports in MS Access 2013. My database serves the function of a project log which tracks what projects our group is working on. The hyperlinks serve as an attachment to a summary file (usually PPT) for each project. Each project is a record in my backend table.
So far I have:
Stored the hyperlink as a string in a database table
Pull/edit/add hyperlink to a record via Access forms
Show the hyperlink and click on it via Access forms
Add the hyperlink on a report by referencing a hidden textbox which houses the path
The problem is that the hyperlink shows up on the report correctly and sometimes I am able to click on it, but the majority of the time I cannot click on it. If I scroll around the report, sometimes I can get the hyperlink active but it seems hit or miss.
Here is the code I used to apply the hyperlink on the report:
Private Sub Detail_Paint()
Dim strSource As String
If Report_rptCompleted.txtHL.Value <> "" Then
strSource = Report_rptCompleted.txtHL.Value
Report_rptCompleted.lblHL.Caption = Right(strSource, Len(strSource) - InStrRev(strSource, "\"))
Report_rptCompleted.lblHL.HyperlinkAddress = strSource
Report_rptCompleted.lblHL.ForeColor = vbBlue
Else
Report_rptCompleted.lblHL.Caption = "No Attachment"
Report_rptCompleted.lblHL.HyperlinkAddress = ""
Report_rptCompleted.lblHL.ForeColor = vbBlack
End If
End Sub
Any help on resolving this issue would be greatly appreciated
I ended up having to go a different route and use a text box instead of a label.
My solution was to drop the label and OnPaint event entirely. I formatted the textbox to show the file name then referenced the file path in the OnClick event with a FollowHyperlink command.
It is a good bit slower opening the link but works fine.

MS Access form ID increment

I'm trying to set up a simple form in MS access to add a new record to a table full of contact information. Each time I add a new record using the form, I want an ID number field to increment by one against whatever the highest value in the ID field is. The code I have right now seems to be working:
Private Sub Contact_ID_Click()
Dim newContactID As Double
newContactID = DMax("[Contact_ID]", "Contacts") + 1
Contact_ID = newContactID
End Sub
The problem is that every time I start the database, open up the form in form view and click on the Contact_ID field to increment it, I get the following error message:
"The expression On Click you entered as the event property setting produced the following error: Object or class does not support the set of events."
I go to design view, open up the code, and then as soon as I switch back to Form view it's working again. I'd like it to work when the form is opened from scratch as others might be using this form and wouldn't know what to do. Any idea what's causing this?

How can I check if an attachment field is empty or not in Access?

I am having some trouble with MS Access 2010. I am trying to modify a database I downloaded, a template from Microsoft‘s web site, I am doing a little modifying to keep track of the food nutrition. I have some experience with basic from the old days of the 16 bit Atari days. I’m not totally green to VBA, just know enough to get in trouble. I have a Form that uses a select query to populate lower half of the form. I added an attachment field to the foods table which has over 8500 record that is the table for the query. My problem is to add VBA code in a module to see if there is a photo present or not. I want to be able to show an icon grayed out for no photo and a regular icon if there is a photo file. But that's for when I get it work to begin with. I call the function in the field properties:
Photo1: chkAttachment([Photo])
This one to start with gives me and error saying: "The multi-valued field '[Photo]' is not a valid in the expression 'chkAttachment([Photo])'. When I change it to:
Photo1: ChkAttachment([Photo].[FileName])
I get and #Error for the empty fields and a "Has Photo" for the one with a file in it.
The Following code is the function I am referencing To Show what I am trying to do
Public Function chkAttachment(fldPhoto As String) As String
On Error GoTo chkAttachment_Err
chkAttachment = ""
'Debug.Print fldPhoto
If fldPhoto = Null Then
chkAttachment = "No Photo"
Else
chkAttachment = "Has Photo"
End If
chkAttachment_Exit:
Exit Function
chkAttachment_Err:
MsgBox " It don't like Error number: " & Err.Number & " " & Error$
Resume chkAttachment_Exit
End Function
The query won’t even call the code if the attachment is empty. I Googled the following question, and searched on this web site “Microsoft Access 2010 VBA how to query attachment field” without any luck. I have tried to use some code to count the number of files in the attachments, I found in the thread “How to query number of attachments from Attachment field in Microsoft Access?” from Aug 2011, but couldn’t figure out how to get it to work. When it comes to SQL, I’m in the dark with that part.
Thanks for any help that comes my way.
Steven
If you have an Attachment control named [attachPhoto] on your form and that control is bound to the [Photo] field (i.e., the Control Source of the Attachment control is Photo) then you can just check the value of
Me.attachPhoto.AttachmentCount
to see if the record has any attachments.
(Note that if you don't want the users to actually see the [attachPhoto] control you can just set its Visible property to No.)
You can check it in SQL statement " Not (tblxx.Pic.FileData) Is Null " probably in the where clause. I did it this way using a recordset.
I believe this is causing the #ERROR in your field
If fldPhoto = Null Then
Correct checking for Null would be the following:
If IsNull(fldPhoto) Then
But then you might still get a Null exception while calling the function. So you might want to edit your overall code to the following:
If (fldPhoto = "") Then
and when calling the function :
Photo1: ChkAttachment(Nz([Photo].[FileName]))
Hope I helped
I wanted to check if an attachment was made or not before running a query on a form. I made a text box in the form and under control source of the text box, went to expression builder and entered " = [name of column which has the attachment].[AttachmentCount]".
The text box gave me the count as 0(zero) if no attachment is made and 1 for 1 attachment. I could use the text box to condition run my query. All the above in Access 07.

Trying to open an image from a URL without the extention - VBA

I am currently trying to work on a database that stores a collection of cards, and I'm trying to fetch Images from Magic's Gatherer service in order to help identify the card.
This is the code I am currently Using:
Private Sub ID_Change()
cardImage.Picture = "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=" & ID.Column(0) & "&type=card"
End Sub
cardImage is a picture object
ID is a combo box, with the first column as a Long Integer.
Now then, my issue is that access isn't liking the URL that I'm providing it, and is throwing a Run-Time error 2220. Is there any way to get access to accept the URL as a JPEG, and load it?
Instead of using an Image object, try using a Web Browser Control object and set its .ControlSource property, something like
Me.WebBrowser2.ControlSource = "=""http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=" & ID.Column(0) & "&type=card"""