Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox Display Window

Status
Not open for further replies.

SteveJR

Programmer
Aug 13, 2001
72
GB
Hi,

Can anyone help me with the following.

I have an Access DB that displays msgbox's when an error has occurred. I want to be able to minimise the Access DB and say be in another application like Word but still get the MsgBox from Access when it has encountered an error. All that happens at the moment is that if you minimise Access when a MsgBox is to be displayed the Access icon on the Taskbar flashes.

I want to do something similar to Outlook where it is running minimised but you get alerts to say a new message has arrived over the top of the current application you are in.

Any help would be much appreciated.

Thanks,

Steve
 
How about sending yourself an e-mail when an error happens. For simple things like this you can use the SendObject command.

You could also look into sending network messages with the shell command, though you'll have to dig into OS/batch programming a bit (I think).

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Here is one way to do it.
Code:
    Dim szHelpFilePath As String
    szHelpFilePath = Application.CurrentProject.Path & "\error.html"
    Application.FollowHyperlink szHelpFilePath, , True

I made a page that says, "There was an error" and had access open it when there was an error. This gave a nice visual cue.

I am working on creating an MsgBox written in Flash MX.
With that, you can ‘transferText’ your error to notepad, save it as .xml and have your flash MX app use the xml doc to display a meaningful message.


 
an alternative i have (which probably won't be useful but i'll say it anyway) is that i run my access database hidden via code. the forms are visible, but the database window/grew access screen are all hidden. when messages occur, they appear above the form.

alternatively, possibly, you could set the forms up to show messages by you, ie onerror sections that say msgbox err.number & err.description. not sure if this works, but it should just appear above anything. worth a try.
 
FredPerry,
How did you hid the Access Frame and keep the Access Objects visible?
 
Before i say this i don't know if it'll fix your problems, but here goes.

all forms are set as popup and modal (properties on all forms)

then i have to a module called accesswindowhider with this code:

(this is taken off somebody else, i imagine it's on an faq somewhere here)

Option Compare Database
Option Explicit

''''''''''''''
' Start Code '
''''''''''''''
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long

Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3

Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function
''''''''''''
' End Code '
''''''''''''

then you have two macros - one called mcrhide with this code:

runcode: fAccessWindow ("Minimize", False, False)

and one called mcrRestore with this:

runcode: fAccessWindow ("Show", False, False)

then on your main (first) form, you put mcrhide in the on_load function (or if you haven't got code for it, list this macro in the properties box for the form).

you have to show it if you need reports to be shown, but that's it.

there is code around this site if you search for it to deactivate opening the database with the shift key and other stuff like that by code, but i'd only use that if you really need it. remember that by deactivating shift keys you will also have no way into the database yourself, so think twice before doing that.

hope it's of use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top