 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 10th, 2003, 10:35 AM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Importing message box won't go away
I am importing JPGs to a form as records are shown. With every record, I import a new JPG, which works fine, BUT I get a message box that says: importing (followed by the path and file name)with a progress bar and a Close button. This doesn't appear on the similar employees form of the Northwind database. Worse yet, if you advance to the next records quickly enough the message box will get stuck on the screen. It won't even go away when you close Access(XP) and I can't get back into the Access program until I reboot WinXP. I would love to get rid of this and I even put a DoEvents in my Next Record command button, but no help. Do any of you pros have a suggestion?
Nashville_Bill
__________________
Nashville_Bill
|
|

December 10th, 2003, 11:12 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
what version of access are you using?
Try this.
open the form in design via. close any form properties you may see including the design wizard. save the form again and see if dialog box for import appears again?
|
|

December 11th, 2003, 09:58 AM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm using Access XP (Access 2002 10.2616.2625). I tried saving without the properties showing but the "importing" box is still there.
Nashville_Bill
|
|

December 12th, 2003, 12:29 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hoe large are the files in megabites? Do not use a continuous form. Use only a single record form.
Sal
|
|

December 12th, 2003, 12:30 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Man it is late. I meant "How Large are the files"
Sal
|
|

December 12th, 2003, 09:26 PM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am using a "Single" and the size of the JPG I am importing is between 35 and 40 K. The message box only appears for long enough to see it but it is annoying and it will get stuck and not go away if I am flying through the records. The only differences I can see from my database and the Northwind, are my picture is going on a subform and I am using code to get the path to the file of the JPG. I think if I could get the message box to not show then it wouldn't get stuck there. I appreciate any suggestions.
Nashville_Bill
|
|

December 12th, 2003, 10:18 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can you post your code as it its. It may be the way the msg box is displayed.
|
|

December 13th, 2003, 08:13 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I knew I'd seen something on this somewhere...
Do either of these methods help?
http://www.mvps.org/access/api/api0038.htm
Brian Skelton
Braxis Computer Services Ltd.
|
|

December 13th, 2003, 12:43 PM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Brian - That is exactly what I am looking for. I searched, and searched for this on Microsoft and with Google, but I didn't find this.
Bill
Nashville_Bill
|
|

December 13th, 2003, 04:18 PM
|
|
Authorized User
|
|
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I know this is hard to belive, but making the registry change made no difference. I still have the same problem. There is no code on the main form but here is the code on the sub-form:
Option Compare Database
Option Explicit
Dim path As String
Private Sub AddPicture_Click()
' Use the Office File Open dialog to get a file name to use
' as an employee picture.
getFileName
End Sub
Private Sub Form_RecordExit(Cancel As Integer)
' Hide the errormsg label to reduce flashing when navigating
' between records.
errormsg.Visible = False
End Sub
Private Sub RemovePicture_Click()
' Clear the file name for the employee record and display the
' errormsg label.
Me![ImagePath] = ""
hideImageFrame
errormsg.Visible = True
End Sub
Private Sub Form_AfterUpdate()
' Requery the ReportsTo combo box after a record has been changed.
' Then, either show the errormsg label if no file name exists for
' the employee record or display the image if there is a file name that
' exists.
'Me!ReportsTo.Requery
On Error Resume Next
'showErrorMessage
showImageFrame
If (IsRelative(Me!ImagePath) = True) Then
Me![ImageFrame].Picture = path & Me![ImagePath]
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If
DoCmd.SetWarnings False
DoEvents
End Sub
Private Sub ImagePath_AfterUpdate()
' After selecting an image for the employee, display it.
On Error Resume Next
showErrorMessage
showImageFrame
If (IsRelative(Me!ImagePath) = True) Then
Me![ImageFrame].Picture = path & Me![ImagePath]
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If
DoEvents
End Sub
Private Sub Form_Current()
' Display the picture for the current employee record if the image
' exists. If the file name no longer exists or the file name was blank
' for the current employee, set the errormsg label caption to the
' appropriate message.
Dim res As Boolean
Dim fName As String
path = CurrentProject.path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = path & "\" & fName
End If
Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
DoEvents
End Sub
Sub getFileName()
' Displays the Office File Open dialog to choose a file name
' for the current employee record. If the user selects a file
' display it in the image control.
Dim fileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "Bitmaps", "*.bmp"
.FilterIndex = 2
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path & "\Pictures\" & [CustomerNumber]
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
fileName = fileName
Me![ImagePath].Visible = True
Me![ImagePath].SetFocus
Me![ImagePath].Text = fileName
Me![txtDescription].SetFocus
Me![ImagePath].Visible = False
End If
End With
DoEvents
End Sub
Sub showErrorMessage()
' Display the errormsg label if the image file is not available.
If Not IsNull(Me!Photo) Then
errormsg.Visible = False
Else
errormsg.Visible = True
End If
End Sub
Function IsRelative(fName As String) As Boolean
' Return false if the file name contains a drive or UNC path
IsRelative = (InStr(1, fName, ":") = 0) And (InStr(1, fName, "\\") = 0)
End Function
Sub hideImageFrame()
' Hide the image control
Me![ImageFrame].Visible = False
End Sub
Sub showImageFrame()
' Display the image control
Me![ImageFrame].Visible = True
End Sub
Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click
DoCmd.GoToRecord , , acNext
DoEvents
Exit_cmdNext_Click:
Exit Sub
Err_cmdNext_Click:
'MsgBox Err.Description
Resume Exit_cmdNext_Click
End Sub
Private Sub cmdPrevious_Click()
On Error GoTo Err_cmdPrevious_Click
DoCmd.GoToRecord , , acPrevious
DoEvents
Exit_cmdPrevious_Click:
Exit Sub
Err_cmdPrevious_Click:
'MsgBox Err.Description
Resume Exit_cmdPrevious_Click
End Sub
As you can see, it's pretty much a copy of the code in the employees form in Northwind.
Nashville_Bill
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Message box |
basie |
Classic ASP Basics |
1 |
September 4th, 2008 01:09 PM |
| Yes No Message box |
dbartelt |
Access |
7 |
October 28th, 2005 08:16 AM |
| Message Box HELP!!! |
Dwizz |
ASP.NET 1.0 and 1.1 Basics |
1 |
July 21st, 2005 07:22 AM |
|
 |