Why is this causing an error? DoCmd.OpenForm and Load methods

Posted on 2003-03-14
Medium Priority
Last Modified: 2006-11-17
I'm trying to open a popup form using VBA and neither the Load or DoCmd options are working:

DoCmd.OpenForm (Form_sfrmSoftwareFailurePopup) <--Says that the argument is the wrong data type.  This is the name of my form in the VBA project Explorer Window.

Load (Form_sfrmSoftwareFailurePopup) <-- Just says I can't load this object.

Question by:spacebaby
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
LVL 18

Accepted Solution

1William earned 200 total points
ID: 8138235
change it to:
DoCmd.OpenForm "Form_sfrmSoftwareFailurePopup"

I am assuming the correct name is Form_sfrmSoftwareFailurePopup
LVL 44

Expert Comment

ID: 8138309
DoCmd.OpenForm "sfrmSoftwareFailurePopup",,,,,acDialog


rather than the Load approach, try it this way:

Dim MyForm as Form_sfrmSoftwareFailurePopup
Set MyForm = New Form_sfrmSoftwareFailurePopup

MyForm.Visible = True

if you have made the form's Modal Property to True, then the form will open as a FDIALOG, requiring the user to respond to THAT form, before going on.

LVL 28

Expert Comment

ID: 8138319
What version of access are you using?

go to the database window and click on the form, press F2 to rename it and then CTRL-C to copy the form name.

In your code you need to do
DoCmd.OpenForm "FormName"

and I suspect you are confucing the Form_ with a feature in VBA that you can reference a form and if the form is not open then it will be opened. This is for example sets the visible property to true in the form sfrmSoftwareFailurePopup and if the form is not open then open it and set the visible property to true.

Form_sfrmSoftwareFailurePopup.visible = True

HTH Andrew

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

743 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