Modules & VBA :: Displaying Picture From Imagelist
Jul 8, 2014
I want to display a picture (or pictures) from Imagelist in the picturebox (KIBES_picture).But I am getting a type mismatch error in the last line. What am I doing wrong?
Code:
Public Sub load_picture()
Dim iml As ImageList
Set iml = New ImageList
iml.ListImages.Add , , LoadPicture("K:Kapa-Planung ElektrikKibes_DatabaseAufbausystemme2_Innenbeleuchtung .00000-0002_Treppebeleuchtung_ueber_2 Schalters_087A00ekran_edycja.jpg")
[Forms]![Search]![KIBES_picture].Picture = iml.ListImages(1)
Besides, when I have Listimage(0) I am getting an other error: Index out of bounds. Strange, because the index should start from zero?
View Replies
ADVERTISEMENT
Sep 14, 2005
I have set up a bound object frame on a form, everything works good, only problem i have is the picture doesn't display but the name of the picture does, ie...picture.jpg. if i click on this the picture is displayed in microsoft office picture manager, I think I'm close..maybe just a shove away..
Please help if you can,,
Thanks,
Jerry
View 2 Replies
View Related
Sep 24, 2014
I am trying to embed a picture in an email, code below:
Code:
Dim MyOutlook As Object
Dim MyMail As Object
Set MyOutlook = New Outlook.Application
Set MyMail = MyOutlook.CreateItem(olMailItem)
[Code] ....
View 3 Replies
View Related
Oct 4, 2014
I use the botton code for save image in SQL
Dim fDialog As Object
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim varFile As Variant
Set Cn = New ADODB.Connection
Cn.Open "Provider=SQLOLEDB;data Source=.;" & _
[Code] ....
But I have a problem when my database more than 2000 record. I think my problem in
rs.Open "Select * from Table_2", Cn, adOpenKeyset, adLockOptimistic
because select all record in Table_2
I decided to use bottom code
strSQL = "INSERT INTO Table_2(image_v,sabt,filetype_v,imageid) Values (mstream.Read,'" & [kodimage] & "','" & [file_type] & "','" & Me.Text8 & "');"
Cnxn.Execute strSQL
But I get an error with mstream.Read!!!!
View 3 Replies
View Related
Jan 29, 2014
I want to my ImageFrame to open as a picture. My problem is that my picture could be either a .jpg or a .png (or whatever). The code below works if I hard code profile_pic.png or profile_pic.jpg. Is there a way to use the wildcard here? (Its not working as written now)
Code:
Dim vFolderPath As String, strFile As String, dirFile As String
vFolderPath = DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'")
dirFile = Dir(vFolderPath & ctrl_people_id & " *", vbDirectory)
strFile = "profile_pic." + "*"
[code]...
View 8 Replies
View Related
Feb 8, 2014
I have below module to save picture under named folder:
Code:
Option Compare Database
Public Enum acFileType
acPicture = 1
acFiles = 2
End Enum
[Code] ....
But how to save the picture with customized name, say "Materials 0001.Jpg"
View 7 Replies
View Related
Dec 17, 2013
I am trying to export an attachment item (Picture .jpg) to a word document. I have been exporting text to a word document successfully with below syntax "
With rst
strLandSalesID = Nz(.Fields("LandSalesID"))
strPhotograph = Nz(.Fields("Attachments"))
However, attachment do not work.
View 3 Replies
View Related
Jul 17, 2015
A newbie problem: Trying too display a linked picture using Win 8.1, get error picture too large. OK in Win 7.
Am using Access 2002 (10.6501.6567) SP3. The instruction flagged is:
Me![ImageFrame].Picture = Me![ImagePath]
View 1 Replies
View Related
Aug 13, 2015
I'm having trouble with a shell() command in my vba.
I'm trying to call up the picture viewer showing the file of the photo I clicked on in a form. Everything is happening as expected - the file opens in Windows Photo Viewer, but it is minimized.
I can open a picture fine from Windows Explorer, but something about my shell command is forcing a minimize.
Here is my code:
Code:
Dim sFile As String
PicFile = "C:Pics" & Me!PicName & ".jpg"
Shell "RunDLL32.exe C:WindowsSystem32Shimgvw.dll,ImageView_Fullscreen " & PicFile
I would have assumed ImageView_Fullscreen would do what I want!
View 4 Replies
View Related
Mar 28, 2014
I've been trying to search for all picture files in my documents and copy them to a folder on the desktop. I found this and it work great for searching however I'm having trouble getting the copy to work. [URL] ....
Code:
Dim colFiles As New Collection
RecursiveDir colFiles, "C:Photos", "*.jpg", True
Dim vFile As Variant
For Each vFile In colFiles
Debug.Print vFile
Next vFile
Code:
I replaced the debug.print vfile with my copy function. I've tried copyfile but it needs to specify the destination with the file name. I tried using the FSO filecopy method and can't get it to work (keep getting a compile error "Expected =") I feel the hard part is done and this part should be simple.
View 3 Replies
View Related
Feb 6, 2005
Hi all ,
Can anyone tell me about how to embedd image in image control using imagelist.
I added the 5 images in imagelist at design time and added the following code.
image.picture=imagelist.listimages(1).picture
but iam getting error.error no :2110,cannot open the file .
thank u,
Siva
View 3 Replies
View Related
Sep 22, 2013
I have created some tables using CREATE TABLE but they do not appear in the list of tables although they are there. How to make them appear.
View 1 Replies
View Related
Dec 4, 2014
I have a form that I would like to update a picture on using VBA. The source of the picture path is in part a query that is not bound to the form. So far I have the following code that is pretty much working, but with a couple flaws.
Code:
Private Sub Form_Current()
LoadDefaultPicture
End Sub
Sub LoadDefaultPicture()
Dim db As DAO.Database
[Code] ....
This is working. However, when I change the record the picture flashes the current picture once and then loads the new picture. It is like it reloads the current picture then loads the new one. I'm hoping there is a way to get rid of the flash.
Also, the code fails here:
strDefaultPictureName = rs.Fields("AttachmentName")
When the query does not return a record. I can definitely fix this by adding an if statement to check for a record, but I'm kind of perplexed at why it is failing at that line. I would expect it to assign an empty string to that variable name and then fail on the next command where I try and set the ".Picture" property of the image.
View 8 Replies
View Related
Oct 7, 2014
I have a database with several one-to-many relationships and a nested subform based off of those relationships. Relationships are as follows:
One Lender to Many Relationship IDs
One Relationship ID to Many Tax IDs
One Tax ID to Many DocumentsRequired
My forms are nested as follows:
Relationship ID form (contains info for Relationship ID and Lender)
-> Tax ID
-> DocumentsRequired
I believe I'm just overcomplicating this. But I have simple search box (an unbound text box with a command button), which is located on the top-level form for Relationship IDs. As you'll see above, that form only contains the fields for Relationship ID and Lender. However, users have to be able to search by Relationship ID, Customer Name, or Tax ID number, the last two of which are only available on the nested subforms. Currently I have the search box reaching out to grab results from a query. When I assign the results to the Me.RecordSource, it works perfectly except that it's in read-only format. The users have to be able to edit the results of their search. I'm not even sure I'm doing this in the easiest fashion. I would have preferred to just use the select statement to search through the subform, but I'm guessing my syntax was wrong because I never got it to work. Below is what I currently have.
Dim strtext As String
Dim strsearch As String
strtext = Me.SearchBoxTxt.Value
strsearch = "SELECT [Relationship ID] " & _
"FROM CustomerNormQuery " & _
"WHERE [Relationship ID] like ""*" & strtext & "*"" OR [Customer Name] Like ""*" & strtext & "*"" " & _
"OR [EIN/SSN] Like ""*" & strtext & "*"" " & _
"GROUP BY [Relationship ID]"
Me.RecordSource = strsearch
View 4 Replies
View Related
May 10, 2015
Code for displaying the Word Print dialogue box instead of sending it straight to the printer.
I have the following code:
'Open Word
Set objWord = New Word.Application
'Letter document would be open
Set objletter = objWord.Documents.Open(strletterpath & strworddoc)
objletter.MailMerge.OpenDataSource (strletterpath & strletterfile)
objletter.MailMerge.Destination = wdSendToPrinter 'normally print
Dialogs(wdDialogFilePrint).Show
objletter.MailMerge.Execute
'not normally here
'objWord.Visible = True
This is to produce a mailmerge based upon a query.
Previously on Access 2000 and Word 2000 it would display the print dialogue box, but I am trying to upgrade it all to 2013 and this does not do it now with Access 2013 and Word 2013.
View 3 Replies
View Related
Sep 24, 2013
Debugging my VBA code. I'm trying to track/display the content/value of a couple of variables to make sure they have the right value at a certain point.
What is the VBA code to say "display content of variable Var1" ? Where exactly will it display the value when instruction is executed?
I know I can just hover the mouse on a variable to see its content but some string varables like SELECT commands are too long and you cannot see the whole string.
View 2 Replies
View Related
Mar 10, 2014
I have a form, which is bound to a table, with an unbound textbox.
I am trying to get the number of months an employee has/had worked.
In the table are two dates, Company Start Date, and Resignation Date.
There are three scenarios in which I need to calculate the months:No Resignation Date
A Resignation Date in the future
A Resignation Date in the Past
See attached PDF
The Employees are under a one-year contract which ends the day before the one-year anniversary.
I originally tried using DateDiff in the Control Source, but the IIF seamed too limited for my needs.
Code:
If [Resignation Date] = "" Then
If Month([Nichii Gakkan Start]) = Month(Date) Then
If Day([Nichii Gakkan Start]) < Day(Date) Then
MIS = DateDiff("m", [Nichii Gakkan Start], Date) - 1
[Code] ....
MIS = The name of the textbox in question.
View 6 Replies
View Related
Aug 11, 2014
I am having bit of confusion in trying to come up with a code that will assist in completing my database display (for a warehouse rental database).
My aim is to have a form display a layout of the site and overlay an image over a store if its occupied else leave the image off if otherwise.
I have everything in my table plus a checkbox field that states if vacancy is "yes' or "no"; say I have 60 stores to rent and they have specific names (unit = A09) and I already 'drew' the layout on a form (all 60 of them) with renaming the boxes for each unit (Name = A09).
How can I program a code that upon opening the form it will like
If 'Box Name on form' = 'unit name on table' AND 'Vacancy = No' then 'redbox.visible = yes'
View 11 Replies
View Related
Sep 19, 2014
I have a Table with 57 fields. I would like to display this table in a form as a subform, but only certain fields depending on what selection is made in a combo box.
For instance, if the user selects "Missing Information" in the Combo Box, then the form will show a few standard fields such as ID, Market, Sales Manager, and then some specific ones such as date missing information requested and date missing information received.
If the user selects another option, again the standard fields will remain plus a few different ones.
I have done much searching on this and feel like I am so close but so far. I have looked into controlling the record source of the subform, columhidden =false and a multitude of others. All of which may or in fact probably do work in this situation but I can't seem to put it all together.
View 4 Replies
View Related
Jul 8, 2015
On this form, there is a text box for Quantity...At the end of the form, there will be a button that when pressed:The current record the data on the form is entered for is saved,A report is printed on a specific printer,I do not want the report to actual display,The number of copies it prints should be equal to what the quantity field indicates.I do have the report already created and the Quantity field is on the report (just not visible).Once this all happens, it should return the user to the form, that is blank, waiting for a new record entry.
View 1 Replies
View Related
Oct 20, 2005
I'm just wondering, is it possible to put a graphics in the code? the reason I want to know is that I will put a sad face on each customer every time they call. so if they will call me 5 times i will see a 5 sad smiley face on the customer information. Can you please help me with this one. or if you know any way to do just let me know. thank you so much.
View 6 Replies
View Related
Jan 24, 2006
Here is my situation. I have a database with a table in which contains all of the names and members of our club. Every member in our club has a rank, the rank is held in a field called "rank". I also have a form which is used to add and edit the information into this table. The form that i have create is a bog standard form with nothing special on it. What i would like to be able to do is when the form loads and the information from the table populates it, i would like a picture box to hold a picture that represents there position like an avatar. I have tried doing this myself however my attempts just resulted in errors about not have the form focus. I use the code editor to do this. I know this is possible to do as i have seen it on some other projects.
If any one has any idea or hints about how i can do this please reply.
As an added thing i would prefer if it was done in the code editor as the machine it has to run on has macros disabled.
View 3 Replies
View Related
Aug 23, 2005
Hi guys.
I have been told to make my database look 'sexier' but I am a bit worried that the pictures may slow it down or increase it's size unneccesarily.
Speed is an issue because we have some offices that dial in and access it that way and as such are limited to their connection speed.
So what I want to do is created a few images, link to them, and put in code that can 'turn them on'.
The question is how?
I have created a new image object. Changed it's properties to linked.
Now I need some code that reads:
If myvalue = "Yes" then
myImage.visible = true
Else
'code to delete image
End If
I am a bit worried because that means that the images will always be there on load up, so loading the form will be just as slow because the images are there.
Or maybe I can do
If myvalue = "Yes" then
'code to create image
End If
Please help.
Edit - Part two to this question is: How do I use relative links for images? I have a folder of images and I want them to work no matter where the database sits.
Edit again - Just another question: Is it possible to have Images appear and disappear depending where the mouse is?
View 3 Replies
View Related
Feb 27, 2005
Have a database that stores information about jewelry. The user wants each record to have a picture of the item. No matter what I try I can’t put a picture field in my table. All help is appreciated. tillessal@yahoo.com :confused:
View 1 Replies
View Related
Aug 29, 2005
I have a form which brings up another form like this
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmImage"
stLinkCriteria = "[ProductID]=" & "'" & Me![txtProductID] & "'"
Me.Visible = False
DoCmd.OpenForm stDocName, , , , , , "SELECT ProductID, Description, Path FROM tblProducts WHERE " & stLinkCriteria & ";"
However, on the frmImage there is also an ImageControl that may or may
not have a picture. The name of the path and filename is stored in a field
in a table (not OLE).
I do not want the frmImage to open at all if no image can be found under the path and name specified. The file/picture name is exactly the same as the ProductID in the link criteria above.
Perhaps a message to say that no image was found.
At the moment the form opens up regardless.
By the way, the Me.Visible = False refers to the form that opens the
frmImage form, so will have to become True if no image found.
Thanks
View 1 Replies
View Related
Sep 27, 2005
I need very very urgent help in database forms. I have 2 pictures. Active and Inactive. How do I go about where when there is no record, the inactive pictures shows, but when there data is entered into the db, the active pictures appear. Can someone please help me??
View 6 Replies
View Related