Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

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

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.

0
spacebaby
Asked:
spacebaby
1 Solution
 
1WilliamCommented:
change it to:
DoCmd.OpenForm "Form_sfrmSoftwareFailurePopup"

I am assuming the correct name is Form_sfrmSoftwareFailurePopup
0
 
Arthur_WoodCommented:
DoCmd.OpenForm "sfrmSoftwareFailurePopup",,,,,acDialog

OR


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.

AW
0
 
TextReportCommented:
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
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now