Need "Browse for File" button 
February 13th, 2008, 03:46 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Need "Browse for File" button
I need some help. I need a button on an Access form that allows the user to browse for a file on our network, and insert it in a field (rather than having to type a path). I dont need any filters because the files can be any number of formats.
I've come across a couple of so-called "simple" solutions, but for the life of me, I either cant understand them or I cant get them to work. I know nothing about VB so if someone can provide a truly simple answer (preferably something I could cut and paste) with clear instructions on how to actually get it to work, I'd be VERY grateful.
Oh, I am coding this in Access 2000, but if I need to, I can code it in Access 2002-2003.
Thanks!
Barb
| 
February 13th, 2008, 04:25 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover I need some help. I need a button on an Access form that allows the user to browse for a file on our network, and insert it in a field (rather than having to type a path). I dont need any filters because the files can be any number of formats.
I've come across a couple of so-called "simple" solutions, but for the life of me, I either cant understand them or I cant get them to work. I know nothing about VB so if someone can provide a truly simple answer (preferably something I could cut and paste) with clear instructions on how to actually get it to work, I'd be VERY grateful.
Oh, I am coding this in Access 2000, but if I need to, I can code it in Access 2002-2003.
Thanks!
Barb | - Set a Reference to Microsoft Office XX.X Object Library.
- Copy and Paste the following code wherever appropriate, changing the name of the Text Box
-
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strSelectedFile = vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fd = Nothing
- Let me know if you have any problems.
| 
February 13th, 2008, 04:54 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Quote: |
Set a Reference to Microsoft Office XX.X Object Library.
| How do I do that? Quote: |
Copy and Paste the following code wherever appropriate,
| I'm afraid I couldnt begin to know where it's appropriate. Can you be more specific? Quote: |
changing the name of the Text Box
| Do you mean I have to change the name of the actual Text Box (what do I change it to?) or do you mean I have to rename the Text Box reference in the below code?
Sorry, I warned you I knew nothing about this
Thanks!
Barb Quote: |
Originally Posted by ADezii - Set a Reference to Microsoft Office XX.X Object Library.
- Copy and Paste the following code wherever appropriate, changing the name of the Text Box
-
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strSelectedFile = vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fd = Nothing
- Let me know if you have any problems.
| | 
February 13th, 2008, 05:59 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover How do I do that?
I'm afraid I couldnt begin to know where it's appropriate. Can you be more specific?
Do you mean I have to change the name of the actual Text Box (what do I change it to?) or do you mean I have to rename the Text Box reference in the below code?
Sorry, I warned you I knew nothing about this
Thanks!
Barb | - To set a Reference to the Microsoft Office Object Library
- In Form Design View
- Select View from the Menu Bar ==> Code
- Select Tools from the Menu Bar ==> References
- Scroll down to the Microsoft Office XX.X Object Library
- Select the Check Box next to this Option
- Click on OK
- Select the Text Box on your Form (Design View) that will show the Path to the selected File
- Right Click on Text Box ==> Properties ==> All Tab ==> Name.
- Rename the Text Box to txtSelectedFile
- Close Properties Dialog Box
| 
February 13th, 2008, 06:49 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Ok, I got that. Now where does the code go? And is there anything I have to do to connect the code to the text box? Quote: |
Originally Posted by ADezii - To set a Reference to the Microsoft Office Object Library
- In Form Design View
- Select View from the Menu Bar ==> Code
- Select Tools from the Menu Bar ==> References
- Scroll down to the Microsoft Office XX.X Object Library
- Select the Check Box next to this Option
- Click on OK
- Select the Text Box on your Form (Design View) that will show the Path to the selected File
- Right Click on Text Box ==> Properties ==> All Tab ==> Name.
- Rename the Text Box to txtSelectedFile
- Close Properties Dialog Box
| | 
February 13th, 2008, 11:02 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Ok, I got that. Now where does the code go? And is there anything I have to do to connect the code to the text box? | Quote: |
Now where does the code go?
| The most obvious location would be the Click() Event of a Command Button. Quote: |
And is there anything I have to do to connect the code to the text box?
| Line #13 connects the code (selected File) to the Text Box as long as it is named txtSelectedFile.
| 
February 14th, 2008, 06:34 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Thanks, that worked great!
One question, though, is that even though I have it set up as a hyperlink, when it's clicked on, nothing happens. Is there some extra coding it needs?
Also, is there any way of also getting an image of the file selected to display?
Thanks so much!
Barb Quote: |
Originally Posted by ADezii The most obvious location would be the Click() Event of a Command Button.
Line #13 connects the code (selected File) to the Text Box as long as it is named txtSelectedFile. | | 
February 14th, 2008, 08:37 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Thanks, that worked great!
One question, though, is that even though I have it set up as a hyperlink, when it's clicked on, nothing happens. Is there some extra coding it needs?
Also, is there any way of also getting an image of the file selected to display?
Thanks so much!
Barb | You definately should have mentioned these 'little details' up front! Is the Control Source for txtSelectedFile a Hyperlink Data Type?
| 
February 14th, 2008, 09:13 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Quote: |
Originally Posted by ADezii You definately should have mentioned these 'little details' up front! Is the Control Source for txtSelectedFile a Hyperlink Data Type? | Sorry. I didint mention it because it was working with the "edit hyperlink" code I tried first.
Anyway, yes, I currently have the control source as a Hyperlink. I also had some trouble initially getting the hyperlink to not use http:// to target the link. I may have done it wrong (i set the format to "file://") so if that's wrong, please tell me the correct method.
Thanks for all your patience!!
| 
February 15th, 2008, 12:28 AM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Sorry. I didint mention it because it was working with the "edit hyperlink" code I tried first.
Anyway, yes, I currently have the control source as a Hyperlink. I also had some trouble initially getting the hyperlink to not use http:// to target the link. I may have done it wrong (i set the format to "file://") so if that's wrong, please tell me the correct method.
Thanks for all your patience!! | You are quite welcome. Now, let's work on the Hyperlink part first. Make a slight change to the code in Line #11, as listed below. Select a Local File first, see if you can Navigate to it via the Hyperlink on the Form Field (txtSelectedFile), then a File on the Network. Let me know how you make out: -
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strSelectedFile = vrtSelectedItem & "#" & vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fd = Nothing
| 
February 15th, 2008, 04:50 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
That worked perfectly, thanks!!
What about getting an image to display? Is it possible to have that function also display as an image? PDF would be the preferred format, since that's the output of our scanners, but if that's not possible, a .tiff or a .jpg would work.
Access does have a method of doing it, but to be honest, it's clunky and difficult and the people using it are not going to get it so if i can get this one function to work, it would be fabulous.
Even if I need a separate button to get the image to display, it would be better than not having the ability to display the image.
Thanks again
-Barb Quote: |
Originally Posted by ADezii You are quite welcome. Now, let's work on the Hyperlink part first. Make a slight change to the code in Line #11, as listed below. Select a Local File first, see if you can Navigate to it via the Hyperlink on the Form Field (txtSelectedFile), then a File on the Network. Let me know how you make out: -
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strSelectedFile = vrtSelectedItem & "#" & vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fd = Nothing
| | 
February 15th, 2008, 05:15 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover That worked perfectly, thanks!!
What about getting an image to display? Is it possible to have that function also display as an image? PDF would be the preferred format, since that's the output of our scanners, but if that's not possible, a .tiff or a .jpg would work.
Access does have a method of doing it, but to be honest, it's clunky and difficult and the people using it are not going to get it so if i can get this one function to work, it would be fabulous.
Even if I need a separate button to get the image to display, it would be better than not having the ability to display the image.
Thanks again
-Barb | I could incorporate code which would check the Selected File's Extension, and if it is one of the standard Graphic File Formats (*.bmp, *.gif, *.wmf, *.jpg) dynamically load the Image into an Iamge Control. This Control would have to have practical dimensions to be effective. Is this what you are looking for?
| 
February 15th, 2008, 10:35 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Yes, that's exactly what I need.
Thanks so much for your help and your patience.
Have a wonderful weekend
-Barb Quote: |
Originally Posted by ADezii I could incorporate code which would check the Selected File's Extension, and if it is one of the standard Graphic File Formats (*.bmp, *.gif, *.wmf, *.jpg) dynamically load the Image into an Iamge Control. This Control would have to have practical dimensions to be effective. Is this what you are looking for? | | 
February 16th, 2008, 01:11 AM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Yes, that's exactly what I need.
Thanks so much for your help and your patience.
Have a wonderful weekend
-Barb | You have a nice weekend, also. I'll try to have a look at it during this weekend and see what I can come up with.
| 
February 16th, 2008, 01:12 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Yes, that's exactly what I need.
Thanks so much for your help and your patience.
Have a wonderful weekend
-Barb | I'm posting some revised code based on an Image Control on your Form named imgSelectedFile, but please download the Attached Test Database on this Thread to get a much clearer picture of what's going on. Let me know how you make out. -
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String, strImagePath As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strImagePath = vrtSelectedItem
-
strSelectedFile = vrtSelectedItem & "#" & vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Select Case Right$(strImagePath, 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
Me![imgSelectedFile].Picture = strImagePath
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fdg = Nothing
| 
February 16th, 2008, 11:54 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
It worked, but when i closed and reopened the form, the link was there, but the image didnt display. In fact, the attached file is the same way. How do I get the image to remain displayed?
Oh, one more thing. Is there a way to get this image to display in a report?
Thanks!
-Barb Quote: |
Originally Posted by ADezii I'm posting some revised code based on an Image Control on your Form named imgSelectedFile, but please download the Attached Test Database on this Thread to get a much clearer picture of what's going on. Let me know how you make out. -
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String, strImagePath As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
With fdg
-
.AllowMultiSelect = False
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems 'onby be 1
-
strImagePath = vrtSelectedItem
-
strSelectedFile = vrtSelectedItem & "#" & vrtSelectedItem
-
Next vrtSelectedItem
-
Me![txtSelectedFile] = strSelectedFile
-
Select Case Right$(strImagePath, 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
Me![imgSelectedFile].Picture = strImagePath
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fdg = Nothing
|
Last edited by truthlover; February 17th, 2008 at 12:34 AM.
Reason: Added question
| 
February 17th, 2008, 12:26 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover It worked, but when i closed and reopened the form, the link was there, but the image didnt display. In fact, the attached file is the same way. How do I get the image to remain displayed?
Oh, one more thing. Is there a way to get this image to display in a report?
Thanks!
-Barb | The following code will dynamically load specific 'Graphic' Image Types into the Image Control on your Form while viewing (based on the displayed Link). Place it in the Current() Event of your Form as indicated below. It is pretty self-explanatory, but if you need to know how it works, just let me know: -
Private Sub Form_Current()
-
If Not IsNull(Me![txtSelectedFile]) Then
-
Select Case Right$(Me![txtSelectedFile], 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
'Extract the Address Section from the Hyperlink
-
Me![imgSelectedFile].Picture = Left$(Me![txtSelectedFile], InStr(Me![txtSelectedFile], "#") - 1)
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else
-
Me![imgSelectedFile].Picture = ""
-
End If
-
End Sub
| 
February 17th, 2008, 08:09 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
There was no Current() option in the events. I am probably using the wrong type of image control. In fact, when I tried to put an image control in, it kept making me chose a source, so I ended up copy/pasting the image control from the sample you attached.
Can you tell me how to insert the proper Image control?
Thanks Quote: |
Originally Posted by ADezii The following code will dynamically load specific 'Graphic' Image Types into the Image Control on your Form while viewing (based on the displayed Link). Place it in the Current() Event of your Form as indicated below. It is pretty self-explanatory, but if you need to know how it works, just let me know: -
Private Sub Form_Current()
-
If Not IsNull(Me![txtSelectedFile]) Then
-
Select Case Right$(Me![txtSelectedFile], 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
'Extract the Address Section from the Hyperlink
-
Me![imgSelectedFile].Picture = Left$(Me![txtSelectedFile], InStr(Me![txtSelectedFile], "#") - 1)
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else
-
Me![imgSelectedFile].Picture = ""
-
End If
-
End Sub
| | 
February 17th, 2008, 11:21 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover There was no Current() option in the events. I am probably using the wrong type of image control. In fact, when I tried to put an image control in, it kept making me chose a source, so I ended up copy/pasting the image control from the sample you attached.
Can you tell me how to insert the proper Image control?
Thanks | Quote: |
There was no Current() option in the events.
| - Form Design View
- Properties
- Event Tab
- On Current
- Click on ... to advance to the Current() Event
Quote: |
Can you tell me how to insert the proper Image control?
| - Form Design View
- View ==> Toolbox
- Select Image Control then draw on Form
- Select any Graphic File then OK
- Select Image Control
- Properties
- Format Tab
- In Picture Property Delete the Path to the Graphic File
- Answer Yes to the Do you want to remove the Picture from Form prompt
- Rename the Image Control to imgSelectedFile
| 
February 18th, 2008, 01:47 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
That did the trick. Turned out the reason I couldnt find the Current () event is because I was looking for it in the image control properties and not the Form properties. Thank you for beign so patient with me.
One last question (I think). Is there a way to get the link and image to show up in a report too?
Thanks
-Barb Quote: |
Originally Posted by ADezii - Form Design View
- Properties
- Event Tab
- On Current
- Click on ... to advance to the Current() Event
- Form Design View
- View ==> Toolbox
- Select Image Control then draw on Form
- Select any Graphic File then OK
- Select Image Control
- Properties
- Format Tab
- In Picture Property Delete the Path to the Graphic File
- Answer Yes to the Do you want to remove the Picture from Form prompt
- Rename the Image Control to imgSelectedFile
| | 
February 18th, 2008, 05:15 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover That did the trick. Turned out the reason I couldnt find the Current () event is because I was looking for it in the image control properties and not the Form properties. Thank you for beign so patient with me.
One last question (I think). Is there a way to get the link and image to show up in a report too?
Thanks
-Barb | Not time right now, will return later.
| 
February 18th, 2008, 06:52 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover That did the trick. Turned out the reason I couldnt find the Current () event is because I was looking for it in the image control properties and not the Form properties. Thank you for beign so patient with me.
One last question (I think). Is there a way to get the link and image to show up in a report too?
Thanks
-Barb | Quote: |
One last question (I think). Is there a way to get the link and image to show up in a report too?
| Yes there is. It may be confusing to explain the entire process in the Post, but it is exactly the same code in the Form's Current() Event posted to the Format() Event of the Detail Section of a Report. I've kept the naming conventions the same to make it easy for you, simply create a Directory (Folder) in the Root Directory of Drive C: named PFDBMPS, namely C:\PFDBMPS. Download the Test Database for this Thread and copy the *.bmps to that Directory. Click on the View Report Button on the Main Menu to see how it is done. -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
If Not IsNull(Me![txtSelectedFile]) Then
-
Select Case Right$(Me![txtSelectedFile], 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
Me![imgSelectedFile].Picture = Left$(Me![txtSelectedFile], InStr(Me![txtSelectedFile], "#") - 1)
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else
-
Me![imgSelectedFile].Picture = ""
-
End If
-
End Sub
| 
February 18th, 2008, 09:26 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
It worked great!
Now everything's doing what I wanted it to do.
Thank you sooooo much for all your help! Not only did you give me the information I needed, you did it in a way I could really make sense of.
If you dont already teach for a living, you should give it some serious thought.
-Barb Quote: |
Originally Posted by ADezii Yes there is. It may be confusing to explain the entire process in the Post, but it is exactly the same code in the Form's Current() Event posted to the Format() Event of the Detail Section of a Report. I've kept the naming conventions the same to make it easy for you, simply create a Directory (Folder) in the Root Directory of Drive C: named PFDBMPS, namely C:\PFDBMPS. Download the Test Database for this Thread and copy the *.bmps to that Directory. Click on the View Report Button on the Main Menu to see how it is done. -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
If Not IsNull(Me![txtSelectedFile]) Then
-
Select Case Right$(Me![txtSelectedFile], 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
Me![imgSelectedFile].Picture = Left$(Me![txtSelectedFile], InStr(Me![txtSelectedFile], "#") - 1)
-
Case Else
-
Me![imgSelectedFile].Picture = ""
-
End Select
-
Else
-
Me![imgSelectedFile].Picture = ""
-
End If
-
End Sub
| | 
February 18th, 2008, 11:01 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover It worked great!
Now everything's doing what I wanted it to do.
Thank you sooooo much for all your help! Not only did you give me the information I needed, you did it in a way I could really make sense of.
If you dont already teach for a living, you should give it some serious thought.
-Barb | I'm glad it all worked out for you, truthlover. BTW, give yourself a pat on the back also for persisting until a solution was arrived at. As far as teaching, you are not gonna believe this one - I'm a retired Philadelphia Fireman after 32+ years who now works Security for a Performing Arts building (Kimmel Center).
| 
February 19th, 2008, 02:33 AM
| | Member | | Join Date: Jan 2008
Posts: 35
| |
Hi , ADezii!
you are great! i try to search and google around to find a solution to make a browse dialog button for almost a day but i still cannot get what i want.
But your code does make what i want works in just a short time!! i can't imagine that you are a retired fireman and still willing to share your knowledge !
Thanks again!
| 
February 19th, 2008, 12:27 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by beemomo Hi , ADezii!
you are great! i try to search and google around to find a solution to make a browse dialog button for almost a day but i still cannot get what i want.
But your code does make what i want works in just a short time!! i can't imagine that you are a retired fireman and still willing to share your knowledge !
Thanks again! | Thanks for the cudos, like everyone else here at TheScripts, we're always glad to help ya!
| 
February 20th, 2008, 03:47 AM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Quote: |
Originally Posted by ADezii I'm glad it all worked out for you, truthlover. BTW, give yourself a pat on the back also for persisting until a solution was arrived at. | Sorry to bother you again, but I'm afraid I'm having a problem with the reports. The image is showing up, but the same image is showing up for all of the records instead of the proper record showing up for each report.
Am I doing something wrong?
Thanks
| 
February 20th, 2008, 08:46 AM
| | Member | | Join Date: Oct 2007
Posts: 58
| |
hi,
Is there a way to put the image onto a Word document or Excel spreadsheet?
Andrew
| 
February 20th, 2008, 12:25 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Sorry to bother you again, but I'm afraid I'm having a problem with the reports. The image is showing up, but the same image is showing up for all of the records instead of the proper record showing up for each report.
Am I doing something wrong?
Thanks | Is [txtSelectedFile] a Bount Text Box in the Detail Section of the Report, since that is what the code is reading?
| 
February 20th, 2008, 12:26 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by rudeman76 hi,
Is there a way to put the image onto a Word document or Excel spreadsheet?
Andrew | Kindly create a seperate Thread concerning this Topic.
| 
February 20th, 2008, 01:57 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Quote: |
Originally Posted by ADezii Is [txtSelectedFile] a Bount Text Box in the Detail Section of the Report, since that is what the code is reading? | I'm not sure. I did it the way you told me, so if that would create a Bound Text Box, then that's what it is. (I went back to look at the properties, but didnt see any clear indication if it is or not.)
One thing I found out, that might make a difference, is where the problem is occurring is when I run a report that includes all records.
The application is for Work Orders, most that will have corresponding maps. If I open the report for a specific Work Order #, I get the correct image displayed, but if I run a report of all open Work Orders, the image for the first open Work Order displays on all the Work Orders.
Thanks!
| 
February 20th, 2008, 03:36 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover I'm not sure. I did it the way you told me, so if that would create a Bound Text Box, then that's what it is. (I went back to look at the properties, but didnt see any clear indication if it is or not.)
One thing I found out, that might make a difference, is where the problem is occurring is when I run a report that includes all records.
The application is for Work Orders, most that will have corresponding maps. If I open the report for a specific Work Order #, I get the correct image displayed, but if I run a report of all open Work Orders, the image for the first open Work Order displays on all the Work Orders.
Thanks! | The code must reside in the Format() Event of the Detail Section, is that where you placed it?
| 
February 20th, 2008, 04:23 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Yes, it's in the On Format() Event in the Detail section of the report.
Something thing I just noticed is not only is first Work Order is the only one that displays the proper image, it's also the only one that displays the link to the file. The rest of the records it displays nothing (I'm guessing that's why the images arent updating) Quote: |
Originally Posted by ADezii The code must reside in the Format() Event of the Detail Section, is that where you placed it? | | 
February 21st, 2008, 02:04 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Hi ADezii,
Any ideas on the solution yet? The database is going live today so I need to get this resolved soon.
Thanks!! Quote: |
Originally Posted by truthlover Yes, it's in the On Format() Event in the Detail section of the report.
Something thing I just noticed is not only is first Work Order is the only one that displays the proper image, it's also the only one that displays the link to the file. The rest of the records it displays nothing (I'm guessing that's why the images arent updating) | | 
February 21st, 2008, 02:21 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Hi ADezii,
Any ideas on the solution yet? The database is going live today so I need to get this resolved soon.
Thanks!! | Were valid Links created for the rest of the Records? The problem can't be that complicated, and I honestly cannot see how the DB can go live while this little bug still exists. Is there any chance that you can E-Mail the DB or a subset of it to me as an Attachment? If so, I'll send you my E-Mail Address in a Private Message, and then you can Upload it to me. II will look at it ASAP.
| 
February 21st, 2008, 02:50 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Yes, I can upload the DB to you. It's about 3mb.
As for going live with it, though the bug definitely needs to be fixed asap, it does not adversely effect creating the work orders and monitoring everyone's workload, which is something we needed up and running two weeks ago. And where a hard copy of a work order is needed, as long as it's printed out as a single record, the image prints properly
I cant tell you how much I appreciate your help. I couldnt have completed it without you. Quote: |
Originally Posted by ADezii Were valid Links created for the rest of the Records? The problem can't be that complicated, and I honestly cannot see how the DB can go live while this little bug still exists. Is there any chance that you can E-Mail the DB or a subset of it to me as an Attachment? If so, I'll send you my E-Mail Address in a Private Message, and then you can Upload it to me. II will look at it ASAP. | | 
February 22nd, 2008, 11:37 AM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Thanks so much for the file. Havent had time to post response. Will get to it later this morning. Quote: |
Originally Posted by truthlover Yes, I can upload the DB to you. It's about 3mb.
As for going live with it, though the bug definitely needs to be fixed asap, it does not adversely effect creating the work orders and monitoring everyone's workload, which is something we needed up and running two weeks ago. And where a hard copy of a work order is needed, as long as it's printed out as a single record, the image prints properly
I cant tell you how much I appreciate your help. I couldnt have completed it without you. | | 
February 22nd, 2008, 01:32 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| | Quote: |
I've made several modifications to the Report including only restricting it to the Records which have a Link value entered into the Field ([Link] = Not Null). No sense to me displaying an Image Reports with no Images for certain Records. You can still play around with it, let me know what you think via TheScripts. Please see the attached Database which contains the corrections.
| Ok, I looked at the file, and i see the report you created out of the Images table, but the reports I am having problems with are still doing the same thing.
The report I need fixed is "rpt_SurveyWorkOrder(Current)". Sorry, I should have been clearer about which report was the problem. Quote: |
Originally Posted by truthlover Thanks so much for the file. Havent had time to post response. Will get to it later this morning. | | 
February 22nd, 2008, 06:19 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Ok, I looked at the file, and i see the report you created out of the Images table, but the reports I am having problems with are still doing the same thing.
The report I need fixed is "rpt_SurveyWorkOrder(Current)". Sorry, I should have been clearer about which report was the problem. | I sent a revised Database to you @ 2:15 P.M.
| 
February 24th, 2008, 02:05 AM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Hi ADezi
Sorry I didnt post sooner, but I was a way from the computer for a while.
Anyway, all the images are displaying properly Thank you so much.
One question, though. The records with no links are properly not showing any image, but it appears that the space for the image is retained. Is there any way of getting rid of that so it doesnt print two pages unnecessarily?
And if you could tell me how to get rid of that process dialog that would be fantastic (will it also speed up the launching of the application?)
Thanks again and enjoy the rest of your weekend. Quote: |
Originally Posted by ADezii I sent a revised Database to you @ 2:15 P.M. | | 
February 24th, 2008, 10:45 AM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Hi ADezi
Sorry I didnt post sooner, but I was a way from the computer for a while.
Anyway, all the images are displaying properly Thank you so much.
One question, though. The records with no links are properly not showing any image, but it appears that the space for the image is retained. Is there any way of getting rid of that so it doesnt print two pages unnecessarily?
And if you could tell me how to get rid of that process dialog that would be fantastic (will it also speed up the launching of the application?)
Thanks again and enjoy the rest of your weekend. | Quote: |
One question, though. The records with no links are properly not showing any image, but it appears that the space for the image is retained. Is there any way of getting rid of that so it doesnt print two pages unnecessarily?
| Not really sure, but when I get a chance, I'll see what I can do. Quote: |
And if you could tell me how to get rid of that process dialog that would be fantastic (will it also speed up the launching of the application?)
| It will speed up the opening of the opening of the Report and the Application itself when the *.jpgs are loaded into the Image Control, but be very careful since the fix does involve editing of the Registry.
'Reference the following Link, specifically the Post by me (ADezii) dated January 18, 2008 12:57 A.M. The BLOB (not the Movie) | 
February 24th, 2008, 11:49 AM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Hi ADezi
Sorry I didnt post sooner, but I was a way from the computer for a while.
Anyway, all the images are displaying properly Thank you so much.
One question, though. The records with no links are properly not showing any image, but it appears that the space for the image is retained. Is there any way of getting rid of that so it doesnt print two pages unnecessarily?
And if you could tell me how to get rid of that process dialog that would be fantastic (will it also speed up the launching of the application?)
Thanks again and enjoy the rest of your weekend. | Your problem with the blank 2nd Page can be easily solved by setting the Top and Bottom Margins of the Report to the absolute minimum (set both to 0, Access will re-adjust and Fix), and removing the Page Footer, and possibly reducing empty spaces between controls. Now, everything will fit on a single Page. I've tried this and it does work.
| 
February 24th, 2008, 10:16 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
That works as long as the image stays the size it is, but the size of the image actually should be bigger than what I have there now. I dont imagine there's a way to have the image control expand or contract with the size of the linked image, is there?
Thanks! Quote: |
Originally Posted by ADezii Your problem with the blank 2nd Page can be easily solved by setting the Top and Bottom Margins of the Report to the absolute minimum (set both to 0, Access will re-adjust and Fix), and removing the Page Footer, and possibly reducing empty spaces between controls. Now, everything will fit on a single Page. I've tried this and it does work. | | 
February 24th, 2008, 11:55 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover That works as long as the image stays the size it is, but the size of the image actually should be bigger than what I have there now. I dont imagine there's a way to have the image control expand or contract with the size of the linked image, is there?
Thanks! | Modifying the Clip, Zoom, and Stretch Properties, you can vary how a Graphic Image is displayed within the Image Control. The Image Control, unfortunately, will not adjust to the size of the Image.
| 
February 25th, 2008, 01:03 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
I figured as much.
Thanks again for all your help. I know this wasnt anything like fighting a fire, but you're still a hero in my book! Quote: |
Originally Posted by ADezii Modifying the Clip, Zoom, and Stretch Properties, you can vary how a Graphic Image is displayed within the Image Control. The Image Control, unfortunately, will not adjust to the size of the Image. | | 
February 25th, 2008, 01:32 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover I figured as much.
Thanks again for all your help. I know this wasnt anything like fighting a fire, but you're still a hero in my book! | Thanks, truthlover, the pleasure was all mine.
| 
March 7th, 2008, 04:43 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Hi ADezii,
Sorry to bother you again, but is there any way to get this application to allow multiple files to be attached?
Thanks! Quote: |
Originally Posted by ADezii Thanks, truthlover, the pleasure was all mine. | | 
March 7th, 2008, 11:43 PM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Hi ADezii,
Sorry to bother you again, but is there any way to get this application to allow multiple files to be attached?
Thanks! | The AllowMultiSelect Property of the FileDialog determines if multiple files can be selected and you'll have to readjust your code to place these files into a Variant Array, but I do not see how this is relevant in your specific case.
| 
March 10th, 2008, 01:42 PM
|  | Member | | Join Date: Dec 2007
Posts: 107
| |
Actually, you're right. It doesnt directly apply to the control that allows the map to be displayed, but they did ask that multiple related files (of all types) could be "attached" so anyone referring to the work order could access the related files from one place.
So what would I do? Create a separate control that doesnt display anything? Would I store it in the same table as the images, or should i create a separate table?
Thanks! Quote: |
Originally Posted by ADezii The AllowMultiSelect Property of the FileDialog determines if multiple files can be selected and you'll have to readjust your code to place these files into a Variant Array, but I do not see how this is relevant in your specific case. | | 
March 11th, 2008, 01:04 AM
|  | Expert | | Join Date: Apr 2006 Location: Philadelphia Age: 60
Posts: 4,830
| | Quote: |
Originally Posted by truthlover Actually, you're right. It doesnt directly apply to the control that allows the map to be displayed, but they did ask that multiple related files (of all types) could be "attached" so anyone referring to the work order could access the related files from one place.
So what would I do? Create a separate control that doesnt display anything? Would I store it in the same table as the images, or should i create a separate table?
Thanks! | Here is a code segment which will: - Allow you to select Multiple Files.
- Check every Selected File, and if it is one of the specified Formats, dynamically loads its Path into an Array.
- The prior contents of the Array are Preserved and it is Re-dimensioned.
- All the Selected File Paths are now contained in the Array arrsGraphicFiles().
- List all these Files and their Paths to the Immediate Window.
- To test the code, I selected hundreds of Files in the Windows Directory, 6 of which were of a Graphic nature (*.bmp).
- The results are listed below, as well as the code.
-
Dim fdg As FileDialog, vrtSelectedItem As Variant
-
Dim strSelectedFile As String, strImagePath As String
-
Dim intCounter As Integer, arrsGraphicFiles() As String
-
-
Set fdg = Application.FileDialog(msoFileDialogFilePicker)
-
-
intCounter = 0
-
-
With fdg
-
.AllowMultiSelect = True
-
.InitialView = msoFileDialogViewDetails
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems
-
Select Case Right$(vrtSelectedItem, 4)
-
Case ".wmf", ".emf", ".dib", ".bmp", ".ico", ".gif", ".jpg"
-
intCounter = intCounter + 1
-
ReDim Preserve arrsGraphicFiles(intCounter) 'Redimension and Preserve
-
arrsGraphicFiles(intCounter) = vrtSelectedItem
-
Case Else
-
End Select
-
Next vrtSelectedItem
-
Else 'The user pressed Cancel.
-
End If
-
End With
-
-
Set fdg = Nothing
-
-
'Display the Selected/Graphic Files
-
For intCounter = 1 To UBound(arrsGraphicFiles)
-
Debug.Print arrsGraphicFiles(intCounter)
-
Next
OUTPUT: -
C:\WINDOWS\Prairie Wind.bmp
-
C:\WINDOWS\Rhododendron.bmp
-
C:\WINDOWS\River Sumida.bmp
-
C:\WINDOWS\Santa Fe Stucco.bmp
-
C:\WINDOWS\Soap Bubbles.bmp
-
C:\WINDOWS\Zapotec.bmp
|  | | | Thread Tools | Search this Thread | | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|