![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ & vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" |
|
I am using Access 2000 on a Windows XP laptop. I have a command button that opens a Windows dialog box and prompts you to "please choose a file". The only files that are needed are bmp's or jpg's. The dialog box opens up by default in "list" view. I want it to open in "Thumbnail" view. I don't want all of my folders to open up in "Thumbnail" view. I tried that, and it did not work with the files opened up in the "Windows" dialog box. Nor do I want my other folders to do so. The following code seems to apply to the situation. Is there a statement or a piece of code that I need to add/remove to get the folder to open in "Thumbnail" view? Private Sub cmdAddImage1_Click() On Error GoTo cmdAddImage1_Err Dim strFilter As String Dim lngflags As Long Dim varFileName As Variant strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ & vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" lngflags = tscFNPathMustExist Or tscFNFileMustExist _ Or tscFNHideReadOnly varFileName = tsGetFileFromUser( _ fOpenFile:=True, _ strFilter:=strFilter, _ rlngflags:=lngflags, _ strDialogTitle:="Please choose a file...") If IsNull(varFileName) Then Else Me![ItemPhotoLink1] = varFileName Forms![frmITEMS].Form.Requery End If cmdAddImage1_End: On Error GoTo 0 Exit Sub cmdAddImage1_Err: Beep MsgBox Err.Description, , "Error: " & Err.Number _ & " in file" Resume cmdAddImage1_End End Sub |
#3
| |||
| |||
|
|
Are you conversant in the Visual Basic for Applications (VBA) code that you are using? I ask because it seems "patently obvious to the casual observer" that you _specified_ you wanted all files, to wit: strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ & vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" There's a question and answer series at http://www.mrexcel.com/forum/showthread.php?t=266978 apparently regarding this same code. In that exchange there is a discussion of setting the filter. Most of us here have used code that you'll find at http://access.mvps.org/access/api/api0001.htm which item includes a description of setting the filter, as well... since it uses the same Windows API, either description of what the filter should contain ought to work for you. That code is attributed to: ' Code originally courtesy of: ' Microsoft Access 95 How-To ' Ken Getz and Paul Litwin ' Waite Group Press, 1996 ' Revised to support multiple files: ' 28 December 2007 It uses the Windows Common Dialog as does the code you quote. Rather than try to find the source from which you obtained your code, and research any more on how to use it, I'll just give you those references. I have not used either of these, or more recent (but not necessarily better) approaches to open a dialog in "thumbnail" view and a quick search with Google did not turn up a useful article. I'm sure there is a discussion of that subject somewhere on the net, so it will just be a matter of discovering the proper search words to find it. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access "AndyT" <atofil (AT) cox (DOT) net> wrote in message news:848e5315-8202-43ce-8242-7f8a3fbdf907 (AT) g5g2000prn (DOT) googlegroups.com... I am using Access 2000 on a Windows XP laptop. I have a command button that opens a Windows dialog box and prompts you to "please choose a file". The only files that are needed are bmp's or jpg's. The dialog box opens up by default in "list" view. I want it to open in "Thumbnail" view. I don't want all of my folders to open up in "Thumbnail" view. I tried that, and it did not work with the files opened up in the "Windows" dialog box. Nor do I want my other folders to do so. The following code seems to apply to the situation. Is there a statement or a piece of code that I need to add/remove to get the folder to open in "Thumbnail" view? Private Sub cmdAddImage1_Click() On Error GoTo cmdAddImage1_Err Dim strFilter As String Dim lngflags As Long Dim varFileName As Variant strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ & vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" lngflags = tscFNPathMustExist Or tscFNFileMustExist _ Or tscFNHideReadOnly varFileName = tsGetFileFromUser( _ fOpenFile:=True, _ strFilter:=strFilter, _ rlngflags:=lngflags, _ strDialogTitle:="Please choose a file...") If IsNull(varFileName) Then Else Me![ItemPhotoLink1] = varFileName Forms![frmITEMS].Form.Requery End If cmdAddImage1_End: On Error GoTo 0 Exit Sub cmdAddImage1_Err: Beep MsgBox Err.Description, , "Error: " & Err.Number _ & " in file" Resume cmdAddImage1_End End Sub |
#4
| |||
| |||
|
|
A little more searching (this time with Bing) turned up: *http://www.tek-tips.com/viewthread.c...1216492&page=1 which uses the Windows Scripting approach, but does discuss opening in thumbnail view. Only one caution: some System Administrators delete the Windows Scripting Host because it can be used by hackers/crackers/persons-up-to-no-good, in which case, you obviously will not be able to use it. I did contract/consulting work in a lot of shops, though, and only remember one where the SA had eliminated Windows Scripting Host. -- *Larry Linson, Microsoft Office Access MVP *Co-author: "Microsoft Access Small Business Solutions", published by Wiley *Access newsgroup support is alive and well in USENET comp.databases.ms-access "Access Developer" <accde... (AT) gmail (DOT) com> wrote in message news:99mcshFhahU1 (AT) mid (DOT) individual.net... Are you conversant in the Visual Basic for Applications (VBA) code that you are using? *I ask because it seems "patently obvious to the casual observer" that you _specified_ you wanted all files, to wit: * *strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ * * * * * * *& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" There's a question and answer series at *http://www.mrexcel.com/forum/showthread.php?t=266978 apparently regarding this same code. In that exchange there is a discussion of setting the filter. Most of us here have used code that you'll find at http://access.mvps.org/access/api/api0001.htmwhich item includes a description of setting the filter, as well... since it uses the same Windows API, either description of what the filter should contain oughtto work for you. That code is attributed to: ' Code originally courtesy of: ' Microsoft Access 95 How-To ' Ken Getz and Paul Litwin ' Waite Group Press, 1996 ' Revised to support multiple files: ' 28 December 2007 It uses the Windows Common Dialog as does the code you quote. *Ratherthan try to find the source from which you obtained your code, and research any more on how to use it, I'll just give you those references. I have not used either of these, or more recent (but not necessarily better) approaches to open a dialog in "thumbnail" view and a quick search with Google did not turn up a useful article. *I'm sure there is a discussion of that subject somewhere on the net, so it will just be a matter of discovering the proper search words to find it. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access "AndyT" <ato... (AT) cox (DOT) net> wrote in message news:848e5315-8202-43ce-8242-7f8a3fbdf907 (AT) g5g2000prn (DOT) googlegroups.com... I am using Access 2000 on a Windows XP laptop. I have a command button that opens a Windows dialog box and prompts you to "please choose a file". The only files that are needed are bmp's or jpg's. The dialog box opens up by default in "list" view. I want it to open in "Thumbnail" view. I don't want all of my folders to open up in "Thumbnail" view. I tried that, and it did not work with the files opened up in the "Windows" dialog box. Nor do I want my other folders to do so. The following code seems to apply to the situation. Is there a statement or a piece of code that I need to add/remove to get the folder to open in "Thumbnail" view? Private Sub cmdAddImage1_Click() * *On Error GoTo cmdAddImage1_Err * *Dim strFilter As String * *Dim lngflags As Long * *Dim varFileName As Variant * *strFilter = "All Files (*.*)" & vbNullChar & "*.*" _ * * * * * * *& vbNullChar & "All Files (*.*)" & vbNullChar & "*.*" * *lngflags = tscFNPathMustExist Or tscFNFileMustExist _ * * * * * * * Or tscFNHideReadOnly * *varFileName = tsGetFileFromUser( _ * * * * * * * * *fOpenFile:=True, _ * * * * * * * * *strFilter:=strFilter, _ * * * * * * * * *rlngflags:=lngflags, _ * * * * * * * * *strDialogTitle:="Please choose a file...") * *If IsNull(varFileName) Then * *Else * * * *Me![ItemPhotoLink1] = varFileName * * * *Forms![frmITEMS].Form.Requery * *End If cmdAddImage1_End: * *On Error GoTo 0 * *Exit Sub cmdAddImage1_Err: * *Beep * *MsgBox Err.Description, , "Error: " & Err.Number _ * * * * * * * * * * * * * *& " in file" * *Resume cmdAddImage1_End End Sub- Hide quoted text - - Show quoted text - |
#5
| |||
| |||
|
|
Thank you, Larry for your response. |
|
My problem is, that I don't really understand where and how to put in the thumbnail view code (In my code or the "Getz" code. I see the comment " '.InitialView = msoFileDialogViewThumbnail" in the quoted example, but where do I add that snipit and what specific statement do I need to use to fit my code? |
|
Thanks, in advance, for your patience Larry. |
#6
| |||
| |||
|
|
"AndyT" <ato... (AT) cox (DOT) net> wrote *> Thank you, Larry for your response. You are welcome. *> My problem is, that I don't really understand *> where and how to put in the thumbnail view *> code (In my code or the "Getz" code. I see the *> comment *> " '.InitialView = msoFileDialogViewThumbnail" *> in the quoted example, but where do I add *> that snipit and what specific statement do I *> need to use to fit my code? That particular statement has to be used with the msoFileDialog and won'tdo a thing for you, except give you a compile error, if you try to use it with your code or the Getz code. *I am only "familiar in passing" with the msoFileDialog and other mso... functions, as I tried a few functions, didn't find it any better for what I was doing. *You'd have to put the Public function in a standard module, and call it with the *strFilename = FindPicture(). statement discussed just above the code, which (seems to me) ought to go in the Click event of a CommandButton, which I'd probably name as "cmdBrowseForPicture" and Caption as "Browse for Picture". Now, I have to admit that I have just about completely exhausted my recollections about the "mso..." input /output functions, so if you try this and it doesn't work, post back here and we'll just cross our fingers and hope that someone more familiar with the "mso..." (Windows Scripting Host) functions will jump in and help. *> Thanks, in advance, *for your patience Larry. Actually, I'm not a particularly patient guy, but I've been there, done that, and got a lot of help from others along the way, so I'm reasonably sympathetic/empathetic -- everybody's got to start _somewhere_. What bugs me is that I have vague memories of discussions of "thumbnail" right here in this newsgroup, but can't remember just how to set it in the Getz code. -- *Larry Linson, Microsoft Office Access MVP *Co-author: "Microsoft Access Small Business Solutions", published by Wiley *Access newsgroup support is alive and well in USENET comp.databases.ms-access |
#7
| |||
| |||
|
|
"AndyT" <ato... (AT) cox (DOT) net> wrote Thank you, Larry for your response. You are welcome. My problem is, that I don't really understand where and how to put in the thumbnail view code (In my code or the "Getz" code. I see the comment " '.InitialView = msoFileDialogViewThumbnail" in the quoted example, but where do I add that snipit and what specific statement do I need to use to fit my code? That particular statement has to be used with the msoFileDialog and won't do a thing for you, except give you a compile error, if you try to use it with your code or the Getz code. I am only "familiar in passing" with the msoFileDialog and other mso... functions, as I tried a few functions, didn't find it any better for what I was doing. You'd have to put the Public function in a standard module, and call it with the strFilename = FindPicture(). statement discussed just above the code, which (seems to me) ought to go in the Click event of a CommandButton, which I'd probably name as "cmdBrowseForPicture" and Caption as "Browse for Picture". Now, I have to admit that I have just about completely exhausted my recollections about the "mso..." input /output functions, so if you try this and it doesn't work, post back here and we'll just cross our fingers and hope that someone more familiar with the "mso..." (Windows Scripting Host) functions will jump in and help. Thanks, in advance, for your patience Larry. Actually, I'm not a particularly patient guy, but I've been there, done that, and got a lot of help from others along the way, so I'm reasonably sympathetic/empathetic -- everybody's got to start _somewhere_. What bugs me is that I have vague memories of discussions of "thumbnail" right here in this newsgroup, but can't remember just how to set it in the Getz code. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access |
#8
| |||
| |||
|
|
The answer will, I suspect, be somewhere in the newsgroup archives athttp://groups.google.com, and probably also somewhere in the Microsoft Developer Network (MSDN) site (searching the site for "msoFileDialogFilePicker" resulted in the pagehttp://social.msdn.microsoft.com/Search/en-US?query=msoFileDialogFile... which has many, many references. -- *Larry Linson, Microsoft Office Access MVP *Co-author: "Microsoft Access Small Business Solutions", published by Wiley *Access newsgroup support is alive and well in USENET comp.databases.ms-access "AndyT" <ato... (AT) cox (DOT) net> wrote in message news:62049bec-fb38-41e2-b398-5387922dfcc2 (AT) j9g2000prj (DOT) googlegroups.com... On Aug 2, 8:06 pm, "Access Developer" <accde... (AT) gmail (DOT) com> wrote: "AndyT" <ato... (AT) cox (DOT) net> wrote Thank you, Larry for your response. You are welcome. My problem is, that I don't really understand where and how to put in the thumbnail view code (In my code or the "Getz" code. I see the comment " '.InitialView = msoFileDialogViewThumbnail" in the quoted example, but where do I add that snipit and what specific statement do I need to use to fit my code? That particular statement has to be used with the msoFileDialog and won't do a thing for you, except give you a compile error, if you try to use it with your code or the Getz code. I am only "familiar in passing" with the msoFileDialog and other mso... functions, as I tried a few functions, didn't find it any better for what I was doing. You'd have to put the Public function in a standard module, and call it with the strFilename = FindPicture(). statement discussed just above the code, which (seems to me) ought to go in the Click event of a CommandButton, which I'd probably name as "cmdBrowseForPicture" and Caption as "Browse for Picture". Now, I have to admit that I have just about completely exhausted my recollections about the "mso..." input /output functions, so if you try this and it doesn't work, post back here and we'll just cross our fingers and hope that someone more familiar with the "mso..." (Windows Scripting Host) functions will jump in and help. Thanks, in advance, for your patience Larry. Actually, I'm not a particularly patient guy, but I've been there, done that, and got a lot of help from others along the way, so I'm reasonably sympathetic/empathetic -- everybody's got to start _somewhere_. What bugs me is that I have vague memories of discussions of "thumbnail" right here in this newsgroup, but can't remember just how to set it in the Getz code. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access Thanks again Larry. I appreciate your honesty! I tried inserting the "mso" code and the included code module (in the example). I can't get it to work. It seems like there should be a simple way to offset the default "List" to "Thumbnail", but I can't find it on the internet, nor do I have enough programming knowledge to know where to go for the exact information that is required. Your assistance and understanding are greatly appreciated!- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |