Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open Process in Access 2013 will not open form

Posted on 2016-10-20
8
Medium Priority
?
68 Views
Last Modified: 2016-11-08
I have a form "fPreproject" which is supposed to automatically open when I click on my database.  When I click on debug, the error pops up as existing in the third line of the code below (DoCmd.OpenForm "fPREPROJECT",,,,,acHidden.)  The code appears simple enough, but I keep receiving the 2501 error code which says, "the openform action was cancelled".  I am new to coding.  Am I incorrectly calling up the form to open in Access 2013.  I am used to Access 2003, so I thought maybe I am using an incorrect syntax.

Public Function OpenfPREPROJECT()
    Application.Echo False
    DoCmd.OpenForm "fPREPROJECT", , , , , acHidden
    Application.Echo True
End Function

Public Function OpenProcs()
Application.Echo False
Call UseAQMenuBar
Call SetEnterOption
Call genCurrDBPath
Call AssistantOff
Call qProjectDataOpen
Call qProjPenDataOpen
Application.Echo False
DoCmd.OpenForm "fPREPROJECT", , , , , acHidden
DoCmd.OpenForm "fAQSplashForm"
Application.Echo True
End Function

Open in new window

0
Comment
Question by:Tammy Allen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41852904
is the form running any code when it loads?
and/or do you have the form set as the startup item for the database?
0
 
LVL 22
ID: 41853271
as asked, is there code behind the form you are opening? It sounds to me like there might be an OPEN event that is being cancelled
0
 

Author Comment

by:Tammy Allen
ID: 41853651
There is an Open Event associated with the file.  The open event code is:

Private Sub Form_Open(Cancel As Integer)
Dim db As DAO.Database
Set db = CurrentDb()
'load the Rowsource for [prmEmpNo]
'code below performs a query and loads information
'from the EMPLOYEE table into the Rowsource
Dim EmpInfo As DAO.Recordset
Dim i As Integer
Dim qte
qte = Chr(34)
Dim prm As Parameter
Dim QD As DAO.QueryDef
    Set QD = db.QueryDefs("qCmbEmpInfo2")
For i = 0 To QD.Parameters.Count - 1
    Set prm = QD.Parameters(i)
    prm.Value = Eval(prm.Name)
Next i
Set EmpInfo = QD.OpenRecordset(dbOpenDynaset)
EmpInfo.MoveFirst
Do Until EmpInfo.EOF
    [prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & EmpInfo![EmpInfo] & qte & ";" & qte & EmpInfo![Empl_No] & qte & ";"
EmpInfo.MoveNext
Loop
EmpInfo.Close
'this adds an additional entriy at the beginning of Rowsource
[prmEmpNo].RowSource = qte & "AllActive" & qte & ";" & qte & "Actv" & qte & ";" & [prmEmpNo].RowSource
'this adds additional entries to the end of Rowsource
[prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "TOXICS" & qte & ";" & qte & "tox" & qte & ";"
[prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "STATIONARY SOURCE" & qte & ";" & qte & "cmp" & qte & ";"
[prmEmpNo].RowSource = [prmEmpNo].RowSource & qte & "AllEmployees" & qte & ";" & qte & "AllEmployees" & qte & ";"
'sets values of startup parameter fields
Forms![fPREPROJECT]![prmProjectGroup] = "AllProjects"
Forms![fPREPROJECT]![prmOpenClosed] = 2
Forms![fPREPROJECT]![prmEmpNo] = "Actv"
DoCmd.Maximize
Me![fProjectData].SetFocus

End Sub

Open in new window


The complete Open code is:

Public Function OpenfPREPROJECT()
    Application.Echo False
    DoCmd.OpenForm "fPREPROJECT", , , , , acHidden
    Application.Echo True
End Function

Public Function OpenProcs()
Application.Echo False
Call UseAQMenuBar
Call SetEnterOption
Call genCurrDBPath
Call AssistantOff
Call qProjectDataOpen
Call qProjPenDataOpen
Application.Echo False
DoCmd.OpenForm "fPREPROJECT", , , , , acHidden
DoCmd.OpenForm "fAQSplashForm"
Application.Echo True
End Function

Open in new window



Also, I have attached the error messages.  This particular form will not allow me to select layout view, only design view.  This form used to open in layout view, which no longer seems to be an option

error codes associated with opening fPREPROJECT form
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22
ID: 41854737
you would have to post all the code in the procedures that were called -- as well specify relevant portions of your database structure before we could have a hope to know what is really going on ... and it would take quite a bit of time to do that.
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41854754
If you disable different sections of the code does the form stay open?
Try adding error trapping and reporting code to the functions in play. This way you should get an idea of which error in which code is the problem.
I sometimes increment a variable for every line of code and display the variable in the error routine so I know where it is failing.
0
 

Author Comment

by:Tammy Allen
ID: 41857242
I am going to check back in the original code from Access 2003 to see if some code changes were not documented correctly.
0
 
LVL 7

Accepted Solution

by:
COACHMAN99 earned 2000 total points
ID: 41857247
I don't know your level of VBA expertise, but disabling code is usually the quickest way to zoom in on the problem.
initially, comment all and run, then (if no error) gradually enable code from the top and run until the error returns.

Alternatively, put a break watch on the first line ('Set db = CurrentDb()') , and step (F8) line-by-line until the error comes.
0
 

Author Closing Comment

by:Tammy Allen
ID: 41879620
COACHMAN99 always provide precise knowledge of troubleshooting.  This particular code will need full re-working.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question