VBA Express Forum  
Google
 




Go Back   VBA Express Forum > VBA Code & Other Help > PowerPoint Help
     Feedback     
Register FAQ Members Arcade KBase Articles

Reply
 
Thread Tools Display Modes
Old 06-30-2010, 04:02 PM   #1
Waubain

 
Joined: Apr 2010
Posts: 5
Kb Entries: 0
Articles: 0
Placing msgbox in foreground

I use a button on a slide in PP that calls up an Access database, randomly chooses a student, and places that student name in a Msgbox. My problem is that in Slide Show (PP 2007) the Msgbox sits behind the slide not in the foreground as in the past. It works fine in the VBA window. Any advice is appreciated.

PP Slide Button VBA:

Private Sub cmdchoose_Click()
Call HideTaskbar
Const cDatabaseToOpen = "E:\pullname.mdb"
On Error Resume Next
Dim AcApp As Object
Set AcApp = CreateObject("Access.Application")
Application.ShowWindowsInTaskbar = msoFalse
If Val(AcApp.Version) >= 12 Then ' original was 11
AcApp.AutomationSecurity = 1 ' msoAutomationSecurityLow
End If
AcApp.Application.Visible = False
AcApp.OpenCurrentDatabase cDatabaseToOpen
If AcApp.CurrentProject.FullName <> "" Then
AcApp.UserControl = True
Else
AcApp.Application.Quit 'origially AcApp.Quit
MsgBox "Failed to open '" & cDatabaseToOpen & "'."
End If
AcApp.DoCmd.RunMacro "autoexec"
Call UnhideTaskbar
End Sub

Access Form VBA:

Option Compare Database
Option Explicit
Private Sub cmdrandomstudent_Click()
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblstudents")
rst.Index = "id"
Randomize
rst.Seek "=", Int((DCount("*", "tblstudents") - 1 + 1) * Rnd + 1)
If rst.NoMatch = False Then
MsgBox "" & rst!studentname
End If
End Sub
Private Sub cmdclose_Click()
On Error GoTo Err_cmdclose_Click
DoCmd.Close
Exit_cmdclose_Click:
Exit Sub
Err_cmdclose_Click:
MsgBox Err.Description
Resume Exit_cmdclose_Click

End Sub
Private Sub Form_Load()
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblstudents")
rst.Index = "id"
Randomize
rst.Seek "=", Int((DCount("*", "tblstudents") - 1 + 1) * Rnd + 1)
If rst.NoMatch = False Then
MsgBox "" & rst!studentname
End If
Application.Quit
End Sub

Local Time: 10:21 PM
Local Date: 09-08-2010
Location:

 
Reply With Quote Top
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

PT Cruiser | Web Hosting | Wordpress Themes | Breast Enlargement | Breast Enlargement


All times are GMT -4. The time now is 11:21 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright @2004 - 2009 VBA Express