Results 1 to 11 of 11
  1. #1
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52

    Exclamation Default Forms

    Right now I have a series of forms that eventually the user can get to one form that produces a report in print preview. Once they are done with that though and close the print preview I want the original home screen to come back up for them.



    Is there a way to do this?

    Do I need to add some kind of listener that notices when the preview is closed and will pop the home screen back up?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    I do this with code in the Close event of the report to set focus back to a form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    I am fairly new to alot of this. Could you give me more detail on what you are talking about please.

  4. #4
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    I think June7 is saying that in the Close Event of the report the user was viewing but is now closing you would have code looking something like this:

    Forms!frmYourFormName.SetFocus

  5. #5
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    ok, but can you put a close event on a report that is in print preview??

    I have it opening in print preview because I don't want the user to see it in design view and the only other option would be acViewNormal and that would automaticaly print the report wouldn't it?

  6. #6
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Sorry, I missed the print preview part. I don't know but will go research.

  7. #7
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Well, dumb me. The report I use comes up in Print Preview. Never noticed. Anyway, I have code in the Close event and it works great. I actually check to see which of 2 forms could be open and then check if they are visible. If it isn't I make it visible.

    Code:
     
    Private Sub Report_Close()
    If SysCmd(acSysCmdGetObjectState, acForm, "frmSplitDivision") > 0 Then
     
    If Forms!frmSplitDivision.Visible = False Then
     
    Forms!frmSplitDivision.Visible = True
     
    End If
     
    ElseIf SysCmd(acSysCmdGetObjectState, acForm, "frmV_BHSAReports") > 0 Then
     
    If Forms!frmV_BHSAReports.Visible = False Then
     
    Forms!frmV_BHSAReports.Visible = True
     
    End If
     
    End If

  8. #8
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    I went into design mode and opened up the code and added the following, but then when I close the print preview it doesn't open my home screen.

    Code:
    Private Sub Report_Close()
    If SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") > 0 Then
    If Forms!HomeScreen.Visible = False Then
    Forms!HomeScreen.Visible = True
    End If
    End If
    End Sub

  9. #9
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Do you close HomeScreen when you open the report? If you do then you would need to do something like the below. I only have the MsgBox statement in there so you can be sure the Close event is actually firing.

    Code:
     
    Private Sub Report_Close() 
     
    MsgBox "Report_Close event fired"
     
    If SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") > 0 Then
      
    If Forms!HomeScreen.Visible = False Then
     
    Forms!HomeScreen.Visible = True
     
    End If
     
    ElseIf SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") = 0 Then
     
    DoCmd.OpenForm "HomeScreen"
     
    End If
     
    End Sub
    Last edited by nicknameoscar; 06-09-2011 at 03:34 PM. Reason: corrected placement of MsgBox statement

  10. #10
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    Thanks alot. Works Great.

  11. #11
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Great! Glad it works.

    I just noticed I had put the MsgBox statement in the wrong place. I hope that didn't cause you problems. It is correct now.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. add new column and set default value
    By Juanna_v in forum Programming
    Replies: 4
    Last Post: 02-20-2011, 12:54 PM
  2. Replies: 1
    Last Post: 01-04-2011, 05:04 AM
  3. Export to .pdf with default name
    By jgelpi16 in forum Programming
    Replies: 3
    Last Post: 12-23-2010, 10:27 AM
  4. How to set default form
    By LAazsx in forum Forms
    Replies: 4
    Last Post: 11-28-2010, 12:22 AM
  5. Replies: 4
    Last Post: 04-01-2009, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums