Kamis, 27 Maret 2014

Re: [MS_AccessPros] Work with images with Access using a SQL Server backend.

Art-

You cannot attach files to a post to the group. Note that the text field has to have the full path to the image file.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)




On Mar 27, 2014, at 5:03 PM, Art Lorenzini <dbalorenzini@yahoo.com> wrote:

> This is in Access 2013. This is what I did. I got rid of the Current event code. I then change the control source of imgUnit (image control) to point at Photo (text control)) that has the path to the image. When I run it the image control is blank. I have attached a couple of snapshots for your review.
>
> With Warm Regards,
>
> Arthur D. Lorenzini
> IT System Manager
> Cheyenne River Housing Authority
> Wk.(605)964-4265 Ext. 130
> Fax (605)964-1070
> alorenzini@crhanetwork.org
> "Only those who will risk going too far can possibly find out how far one can go."
>
>
>
>
>
>
>
> On Wednesday, March 26, 2014 3:39 PM, John Viescas <JohnV@msn.com> wrote:
>
>
> If this is Access 2007 or later, all you need is a text field that has the full path to the image, then set that field as the Control Source of the Image control. No code required! That old code was for 2003 that didn't have a Control Source in the Image control.
>
>
> John Viescas, Author
> Microsoft Access 2010 Inside Out
> Microsoft Access 2007 Inside Out
> Microsoft Access 2003 Inside Out
> Building Microsoft Access Applications
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
>
> On Mar 26, 2014, at 9:25 PM, wrmosca@comcast.net wrote:
>
> Continuous forms don't work very well with unbound controls as there is actually only one control that is repeated for each row so the Current event sees only one value for the path. Maybe John can help you with this, but I'm guessing you are stuck with one image.
>>
>>
>> -Bill
>>
>>
>>
>> ---In MS_Access_Professionals@yahoogroups.com, <dbalorenzini@yahoo.com> wrote :
>>
>>
>> Will maybe you can help with this one. I used the sample that John suggested "LoadPictureSample" which work great for the image part of it. But I have a list form called sfrmRSPestControlNoteList ( see attachment for image) which is basically a continuous form which contains the image. But the same image repeats for every record on the form.
>>
>> This is the code from the Current Event() which cam directly from the sample. Even though each record has a different image if you go to the details button. Its all the same image on this form.
>>
>> Private Sub Form_Current()
>> ' Load the current image, if any, when moving to new row
>> Dim strPath As String
>>
>> ' Try to load image - set error trap
>> On Error Resume Next
>> ' If nothing in the photo text,
>> If IsNothing(Me.Photo) Then
>> ' Then set the message
>> 'Me.lblMsg.Caption = "Click Add to create a photo for this Member."
>> ' Make it visible
>> '.lblMsg.Visible = True
>> ' .. and hide the image frame
>> Me.imgPestControl.Visible = False
>> Else
>> strPath = Me.Photo
>> ' Check for characters that indicate a full path
>> If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0) Then
>> ' Just a file name, so add the current path
>> strPath = CurrentProject.Path & "\" & strPath
>> End If
>> ' Attempt to assign the file name
>> Me.imgPestControl.Picture = strPath
>> ' If got an error,
>> If Err <> 0 Then
>> ' Then set the message
>> ' Me.lblMsg.Caption = "Photo not found. Click Add to correct."
>> ' Make it visible
>> ' Me.lblMsg.Visible = True
>> ' .. and hide the image frame
>> 'Me.imgMember.Visible = False
>> Else
>> ' Reveal the picture
>> Me.imgPestControl.Visible = True
>> ' And set the form palette so the picture displays correctly
>> Me.PaintPalette = Me.imgPestControl.ObjectPalette
>> End If
>> End If
>> End Sub
>>
>>
>> With Warm Regards,
>>
>> Arthur D. Lorenzini
>> IT System Manager
>> Cheyenne River Housing Authority
>> Wk.(605)964-4265 Ext. 130
>> Fax (605)964-1070
>> alorenzini@crhanetwork.org
>> "Only those who will risk going too far can possibly find out how far one can go."
>>
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, March 26, 2014 9:40 AM, "wrmosca@comcast.net" <wrmosca@comcast.net> wrote:
>>>
>>>
>>> John/Art
>>> I messed with that forever and never found a solution. I ended up storing the files on our SharePoint server and just stored the file path in SQL.
>>>
>>> Regards,
>>> Bill Mosca, Founder - MS_Access_Professionals
>>> http://www.thatlldoit.com/
>>> Microsoft Office Access MVP
>>> http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852
>>> My nothing-to-do-with-Access blog
>>> http://wrmosca.wordpress.com/
>>>
>>> ---In MS_Access_Professionals@yahoogroups.com, <JohnV@msn.com> wrote :
>>>
>>>
>>> Art-
>>>
>>> Nope. The Image control handles only pictures (jpg, bmp, etc). I don't think you can bind an OLE Object control to varbinary in SQL Server. You really need the equivalent of OLE Object on the Access side.
>>>
>>>
>>> John Viescas, Author
>>> Microsoft Access 2010 Inside Out
>>> Microsoft Access 2007 Inside Out
>>> Microsoft Access 2003 Inside Out
>>> Building Microsoft Access Applications
>>> SQL Queries for Mere Mortals
>>> http://www.viescas.com/%c2%a0
>>> (Paris, France)
>>>
>>>
>>>
>>>
>>> On Mar 26, 2014, at 12:53 AM, Art Lorenzini <dbalorenzini@yahoo.com> wrote:
>>>>
>>>> I knew that was too good to be true. I adapted it to my application and it worked great. But I also have to allow for them to do PDFs and it bombs when I try to pull it in. Any ideas?
>>>>>
>>>>> With Warm Regards,
>>>>>
>>>>> Arthur D. Lorenzini
>>>>> IT System Manager
>>>>> Cheyenne River Housing Authority
>>>>> Wk.(605)964-4265 Ext. 130
>>>>> Fax (605)964-1070
>>>>> alorenzini@crhanetwork.org
>>>>> "Only those who will risk going too far can possibly find out how far one can go."
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, March 25, 2014 4:55 PM, John Viescas <JohnV@msn.com> wrote:
>>>>>
>>>>>
>>>>> Art-
>>>>>
>>>>>
>>>>> Look at LoadPictureSample.zip in the 1_Samples folder on the group website. The example was written for Access 2003 that didn't have a Control Source for the Image control. In 2007 and later, all you need to do is set the contents of the bound field to load the image.
>>>>>
>>>>>
>>>>> John Viescas, Author
>>>>> Microsoft Access 2010 Inside Out
>>>>> Microsoft Access 2007 Inside Out
>>>>> Microsoft Access 2003 Inside Out
>>>>> Building Microsoft Access Applications
>>>>> SQL Queries for Mere Mortals
>>>>> http://www.viescas.com/%c2%a0
>>>>> (Paris, France)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mar 25, 2014, at 10:40 PM, Art Lorenzini <dbalorenzini@yahoo.com> wrote:
>>>>>
>>>>> John,
>>>>>>
>>>>>>
>>>>>> Would there be an example of this somewhere. Because the user will need to add images as well as view them.
>>>>>>
>>>>>> With Warm Regards,
>>>>>>
>>>>>> Arthur D. Lorenzini
>>>>>> IT System Manager
>>>>>> Cheyenne River Housing Authority
>>>>>> Wk.(605)964-4265 Ext. 130
>>>>>> Fax (605)964-1070
>>>>>> alorenzini@crhanetwork.org
>>>>>> "Only those who will risk going too far can possibly find out how far one can go."
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tuesday, March 25, 2014 4:36 PM, John Viescas <JohnV@msn.com> wrote:
>>>>>>
>>>>>>
>>>>>> Art-
>>>>>>
>>>>>>
>>>>>> If there's only one attachment per record, then substitute a text field that contains the address of the image on the server. If there are multiple images per record, then you have to do what Access does behind the scenes - build another 1-M table to contain the links.
>>>>>>
>>>>>>
>>>>>> John Viescas, Author
>>>>>> Microsoft Access 2010 Inside Out
>>>>>> Microsoft Access 2007 Inside Out
>>>>>> Microsoft Access 2003 Inside Out
>>>>>> Building Microsoft Access Applications
>>>>>> SQL Queries for Mere Mortals
>>>>>> http://www.viescas.com/%c2%a0
>>>>>> (Paris, France)
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mar 25, 2014, at 10:19 PM, <dbalorenzini@yahoo.com> <dbalorenzini@yahoo.com> wrote:
>>>>>>
>>>>>> I am currently using Access 2013. I have migrated the backend to SQL Server 2008 R2. In a number of tables I have an attachment field which can contain images or scanned documents. I am asking how I should handle them since there is no attachment type in SQL Server. Is there any examples on how to handle these attachments? The images our stored on a different server.
>>>>>>>
>>>>>>>
>>>>>>> Thank you
>>>>>>> Art Lorenzini
>>>>>>> Sioux Falls SD
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> [Non-text portions of this message have been removed]
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
>



------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/

Tidak ada komentar:

Posting Komentar