can't find form

M

Mark Kubicki

i have a command button on a form [frmMainMenu] that when clicked, closes
that form and opens another [frmFixtureSchedulePrintOptions].
The 2 share the same table as a record source, so i'm doing this to avoid
conflicting updates

the code behind [frmMainMenu] reads like this (below), and functions
correctly

DoCmd.Close
stDocName = "frmFixtureSchedulePrintOptions"
DoCmd.OpenForm stDocName, acNormal

on the new form [frmFixtureSchedulePrintOptions], there is a command button
to save to close itself, and open the previous from [frmMainMenu], and the
code reads like this (below), and does not work.
It is not able to find the form, although it is a correct name

DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMainMenu"
DoCmd.OpenForm stDocName, , , stLinkCriteria

any suggestions would be greastly appreciated
thanks in advance,
mark
 
D

Dirk Goldgar

in message
i have a command button on a form [frmMainMenu] that when clicked, closes
that form and opens another [frmFixtureSchedulePrintOptions].
The 2 share the same table as a record source, so i'm doing this to avoid
conflicting updates

the code behind [frmMainMenu] reads like this (below), and functions
correctly

DoCmd.Close
stDocName = "frmFixtureSchedulePrintOptions"
DoCmd.OpenForm stDocName, acNormal

on the new form [frmFixtureSchedulePrintOptions], there is a command
button to save to close itself, and open the previous from [frmMainMenu],
and the code reads like this (below), and does not work.
It is not able to find the form, although it is a correct name

DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMainMenu"
DoCmd.OpenForm stDocName, , , stLinkCriteria

any suggestions would be greastly appreciated


Have you double-checked the form name? Are you sure you spelled it exactly
right?

Please report the exact error message that you get. Hint: you can probably
press Ctrl+C when the message is displayed, to copy it to the clipboard.
Then you can close the error dialog and paste the message text into a new
reply to this thread.
 
M

Mark Kubicki

just to be sure, I cut and pasted into the code the name of the form (from
the form itself), and am still getting this message:
---------------------------
Microsoft Office Access
---------------------------
Tillotson Design Associates - Lighting Fixture DataBase can't find the form
'frmMainMenu' referred to in a macro expression or Visual Basic code.
---------------------------
OK
---------------------------
thanks again,
-m.



Dirk Goldgar said:
in message
i have a command button on a form [frmMainMenu] that when clicked, closes
that form and opens another [frmFixtureSchedulePrintOptions].
The 2 share the same table as a record source, so i'm doing this to avoid
conflicting updates

the code behind [frmMainMenu] reads like this (below), and functions
correctly

DoCmd.Close
stDocName = "frmFixtureSchedulePrintOptions"
DoCmd.OpenForm stDocName, acNormal

on the new form [frmFixtureSchedulePrintOptions], there is a command
button to save to close itself, and open the previous from [frmMainMenu],
and the code reads like this (below), and does not work.
It is not able to find the form, although it is a correct name

DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMainMenu"
DoCmd.OpenForm stDocName, , , stLinkCriteria

any suggestions would be greastly appreciated


Have you double-checked the form name? Are you sure you spelled it
exactly right?

Please report the exact error message that you get. Hint: you can
probably press Ctrl+C when the message is displayed, to copy it to the
clipboard. Then you can close the error dialog and paste the message text
into a new reply to this thread.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

Mark Kubicki said:
just to be sure, I cut and pasted into the code the name of the form (from
the form itself), and am still getting this message:


Hmm. That is not the error message I get when I call DoCmd.OpenForm for a
form that doesn't exist. I get "The form name '<bad form name>' is
misspelled or refers to a form that doesn't exist." Are you sure that the
code you posted is the code that is failing? Do you by any chance have code
or a macro in the Unload or Close event of frmFixtureSchedulePrintOptions
that refers frmMainMenu? What happens if you set a breakpoint on the
DoCmd.OpenForm statement, so that the code stops before that statement is
executed?
 
M

Mark Kubicki

good catch... further up inthe code I had a requery of trhe missing form
(Forms![frmMainMenu].Requery)
that was causing the eroor (not the DoCmd.OpenForm...)

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top