Form won't open

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hbaf208
    New Member
    • May 2010
    • 7

    Form won't open

    I have a form that I am unable to open. I had the form set to open on startup. It now will not open, even in design mode. I tried creating a form with a command button to open the form and it gives me an error code, "You canceled the previous operation." I tried copying the form and exporting the form. Neither work. All of the code for the form is still in the module. Any suggestions on how I open the form?

    Thanks,
    Jason
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32634

    #2
    Try tracing the code of the form. Use Alt-F11 to switch to the debugger, then put a breakpoint in the code before trying to open the form normally. Trace through till you see why it is closing. See Debugging in VBA for detailed instructions.

    Comment

    • hbaf208
      New Member
      • May 2010
      • 7

      #3
      I tried debugging. I also tried erasing all of the code in the form module. The form will still not open. I exported the entire database to another database but this form doesn't export and I cannot copy it.

      Any other suggestions?

      Thanks, Jason

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32634

        #4
        Sorry Jason. It sound like you have an unrecoverably corrupted form.

        If you attach a copy (<= A2003 format) then I'll check it over for you, but my guess is that it's gone.

        Comment

        • hbaf208
          New Member
          • May 2010
          • 7

          #5
          I've attached the database. One other thing that I noticed before this happened, my c drive was full and I was unable to save another word doc. I now have plenty of space on my hard drive but I'm wondering if this caused the issue.
          Attached Files

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Apparently not, assuming that I'm correct in thinking that the form named 1 is the one you're referring to.

            I can do nothing with it; cannot open it, cannot go into Design View, and cannot import it into another database.

            I'm afraid that NeoPa's guess is correct, and that the form is gone!

            Sorry!

            Welcome to Bytes!

            Linq ;0)>

            Comment

            • Jim Doherty
              Recognized Expert Contributor
              • Aug 2007
              • 897

              #7
              Originally posted by missinglinq
              Apparently not, assuming that I'm correct in thinking that the form named 1 is the one you're referring to.

              I can do nothing with it; cannot open it, cannot go into Design View, and cannot import it into another database.

              I'm afraid that NeoPa's guess is correct, and that the form is gone!

              Sorry!

              Welcome to Bytes!

              Linq ;0)>
              Same here:- compaction, decompilation and even running it through the Application.Sav eAsText routine gave the 'reserved' error meaning it cannot write out the forms structure as text to an external file.

              It is lost!

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32634

                #8
                I would be very confident that the lack of available space caused the corruption Jason. Unfortunately, if these boys have already found it beyond recovery, then my attempts are likely to find the same. I'll give it a go just because I promised to, but don't hold your breath. This is a dead parrot!

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32634

                  #9
                  Assuming the form referred to is 1 as Linq says, the code is not lost. I don't have it working of course, but hopefully the code is something to start with.
                  Code:
                  Option Compare Database
                  
                  Private Sub abc_click()
                      Me.CustList = Null
                      Me.CustList.Requery
                      Me.CustList = Me.CustList.ItemData(0)
                      Me.quotelist = Null
                      Me.quotelist.Requery
                      Me.quotelist = Me.quotelist.ItemData(1)
                      Me.ContactList = Null
                      Me.ContactList.Requery
                      Me.ContactList = Me.ContactList.ItemData(1)
                  End Sub
                  
                  
                  Private Sub Command80_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "Update product names, customer numbers, add HAL personnel, etc..."
                  End Sub
                  
                  Private Sub Command91_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "View reports on quotes, call reports, opportunites, contacts, etc..."
                  End Sub
                  
                  Private Sub custlist_AfterUpdate()
                      Me.quotelist = Null
                      Me.quotelist.Requery
                      Me.quotelist = Me.quotelist.ItemData(1)
                      Me.ContactList = Null
                      Me.ContactList.Requery
                      Me.ContactList = Me.ContactList.ItemData(1)
                      Me.SalesPersonList = Null
                      Me.SalesPersonList.Requery
                      Me.SalesPersonList = Me.SalesPersonList.ItemData(1)
                      Me.CallReportList = Null
                      Me.CallReportList.Requery
                      Me.CallReportList = Me.CallReportList.ItemData(1)
                  
                      
                  End Sub
                  
                  Private Sub NewCallReportCmd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "These include phone conversations, office visits and are designed to share information."
                  End Sub
                  
                  Private Sub NewContactCmd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "Add a new contact. The company name must be entered prior to adding a contact for the company."
                  End Sub
                  
                  Private Sub NewCustomerCmd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "Add a new customer. You cannot add a quote or contact if the customer is not listed above."
                  End Sub
                  
                  Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = False
                  End Sub
                  
                  Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = False
                  End Sub
                  
                  Private Sub Form_Open(Cancel As Integer)
                  If IsNull([Text69]) Then
                  [Option56].Visible = False
                  Else: [Option56].Visible = True
                  End If
                  
                  If IsNull([Text94]) Then
                  [Option54].Visible = False
                  Else: [Option54].Visible = True
                  End If
                  
                  If IsNull([Text93]) Then
                  [Option58].Visible = False
                  Else: [Option58].Visible = True
                  End If
                  
                  If IsNull([Text102]) Then
                  [Option100].Visible = False
                  Else: [Option100].Visible = True
                  End If
                  
                  If IsNull([Text103]) Then
                  [Option104].Visible = False
                  Else: [Option104].Visible = True
                  End If
                  
                  DoCmd.OpenQuery "notactiveupdate"
                  
                  End Sub
                  
                  
                  
                  Private Sub NewQuote_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
                  [Help].Visible = True
                  [Help] = "Enter a new quote. Customers and contacts must be in the system prior to adding them to a quote."
                  End Sub
                  
                  Private Sub origin1_click()
                      Me.quotelist = Null
                      Me.quotelist.Requery
                      Me.quotelist = Me.quotelist.ItemData(1)
                      
                  End Sub
                  Private Sub activity_click()
                      Me.quotelist = Null
                      Me.quotelist.Requery
                      Me.quotelist = Me.quotelist.ItemData(1)
                      
                  End Sub
                  
                  
                  Private Sub PreviewReport_Click()
                      
                  
                  On Error GoTo Err_PreviewReport_Click
                  
                      Dim stDocName As String
                  
                      stDocName = "quotes"
                      
                      If IsNull(forms![1]![QLnum]) Then
                      MsgBox "You must select a quote to view the report."
                      Else
                      DoCmd.OpenReport stDocName, acPreview
                      
                      End If
                  Exit_PreviewReport_Click:
                      Exit Sub
                  
                  Err_PreviewReport_Click:
                      MsgBox Err.Description
                      Resume Exit_PreviewReport_Click
                      
                  End Sub
                  
                  
                  Private Sub quotelist_DblClick(Cancel As Integer)
                  DoCmd.Close acReport, "quotes"
                  DoCmd.OpenReport "quotes", acPreview
                  End Sub
                  Private Sub EditQuote_Click()
                  On Error GoTo Err_EditQuote_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "Quotes Form"
                      
                      stLinkCriteria = "[Quote Number]=" & Me![QLnum]
                      DoCmd.OpenForm stDocName, , , stLinkCriteria
                  
                  Exit_EditQuote_Click:
                      Exit Sub
                  
                  Err_EditQuote_Click:
                      MsgBox Err.Description
                      Resume Exit_EditQuote_Click
                      
                  End Sub
                  Private Sub EditContact_Click()
                  On Error GoTo Err_EditContact_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "Contacts Form"
                      
                      stLinkCriteria = "[ContactID]=" & Me![ContactList]
                      DoCmd.OpenForm stDocName, , , stLinkCriteria
                  
                  Exit_EditContact_Click:
                      Exit Sub
                  
                  Err_EditContact_Click:
                      MsgBox Err.Description
                      Resume Exit_EditContact_Click
                      
                  End Sub
                  Private Sub NewQuote_Click()
                  On Error GoTo Err_NewQuote_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "Quotes Form"
                      DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
                      
                  
                  Exit_NewQuote_Click:
                      Exit Sub
                  
                  Err_NewQuote_Click:
                      MsgBox Err.Description
                      Resume Exit_NewQuote_Click
                      
                  End Sub
                  Private Sub NewContactCmd_Click()
                  On Error GoTo Err_NewContactCmd_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "Contacts Form"
                      DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
                  
                  Exit_NewContactCmd_Click:
                      Exit Sub
                  
                  Err_NewContactCmd_Click:
                      MsgBox Err.Description
                      Resume Exit_NewContactCmd_Click
                      
                  End Sub
                  Private Sub NewCustomerCmd_Click()
                  On Error GoTo Err_NewCustomerCmd_Click
                  
                      Dim stDocName As String
                      Dim stdocname2 As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "NewCustomer Form"
                      stdocname2 = "1"
                      DoCmd.OpenForm stDocName, , , stLinkCriteria
                      DoCmd.Close acForm, stdocname2, acSaveYes
                  
                  Exit_NewCustomerCmd_Click:
                      Exit Sub
                  
                  Err_NewCustomerCmd_Click:
                      MsgBox Err.Description
                      Resume Exit_NewCustomerCmd_Click
                      
                  End Sub
                  Private Sub AddContact3_Click()
                  On Error GoTo Err_AddContact3_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "Contacts Form"
                      DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
                  
                  Exit_AddContact3_Click:
                      Exit Sub
                  
                  Err_AddContact3_Click:
                      MsgBox Err.Description
                      Resume Exit_AddContact3_Click
                      
                  End Sub
                  Private Sub NewCallReportCmd_Click()
                  On Error GoTo Err_NewCallReportCmd_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "CallReportForm"
                      DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
                  
                  Exit_NewCallReportCmd_Click:
                      Exit Sub
                  
                  Err_NewCallReportCmd_Click:
                      MsgBox Err.Description
                      Resume Exit_NewCallReportCmd_Click
                      
                  End Sub
                  
                  Private Sub TimeFrameOption_AfterUpdate()
                  Dim MySQL As String
                  Dim MyCriteria As String
                  MySQL = "SELECT CallReport.ID, CallReport.Numbername, CallReport.Date, CallReport.CallType, CallReport.EnteredBy, CallReport.CustomerContact, CallReport.OtherPersonnelAttending, CallReport.IssueDiscussed, CallReport.RequiresFollowUp, CallReport.FollowUpAssignedTo, CallReport.TypeOfFollowUpRequired FROM CallReport WHERE " & MyCriteria
                    
                  Select Case Me!TimeFrameOption
                  Case Is = 1
                  MyCriteria = "[callreport].[numbername]=[custlist] and [CallReport].[Date] Between Date()-9999999999 And Date()ORDER BY CallReport.Date DESC"
                  Case Is = 2
                  MyCriteria = "[callreport].[numbername]=[custlist] and [CallReport].[Date] Between Date()-180 And Date()ORDER BY CallReport.Date DESC"
                  Case Is = 3
                  MyCriteria = "[callreport].[numbername]=[custlist] and [CallReport].[Date] Between Date()-365 And Date()ORDER BY CallReport.Date DESC"
                  End Select
                    
                  Me!CallReportList.RowSource = MySQL & MyCriteria
                  
                  End Sub
                  
                  Private Sub CallReportEditCmd_Click()
                  On Error GoTo Err_CallReportEditCmd_Click
                  
                      Dim stDocName As String
                      Dim stLinkCriteria As String
                  
                      stDocName = "CallReportForm"
                      
                      stLinkCriteria = "[ID]=" & Me![CallReportList]
                      DoCmd.OpenForm stDocName, , , stLinkCriteria
                  
                  Exit_CallReportEditCmd_Click:
                      Exit Sub
                  
                  Err_CallReportEditCmd_Click:
                      MsgBox Err.Description
                      Resume Exit_CallReportEditCmd_Click
                      
                  End Sub
                  Private Sub ViewCallReportCmd_Click()
                  On Error GoTo Err_ViewCallReportCmd_Click
                  
                      Dim stDocName As String
                  
                      stDocName = "CallReportReport"
                      DoCmd.OpenReport stDocName, acPreview
                  
                  Exit_ViewCallReportCmd_Click:
                      Exit Sub
                  
                  Err_ViewCallReportCmd_Click:
                      MsgBox Err.Description
                      Resume Exit_ViewCallReportCmd_Click
                      
                  End Sub

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32634

                    #10
                    I find I can do no more to recover anything I'm afraid.

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32634

                      #11
                      Some more advice for working in Access. I developed this for posting guidelines, but it's sound advice for working generally too :
                      1. Ensure you have Option Explicit set (See Require Variable Declaration).
                      2. Try to compile it. If it doesn't compile for any reason please explain that clearly - including the error message and which line of your code it appears on. Compilation is done from the Visual Basic Editor menu - Debug \ Compile Project (Where Project is the actual name of your project).

                      These should help you find any problems earlier in the process. Good luck.

                      Comment

                      Working...