473,698 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2450 error. A97 fails to find saved form?

MLH
I seem to remember the code below working before.
But, today, it is not. Instead, I get a 2450 error complaining
that it cannot find the named form. This is true regardless
of which form name I enter. Is perplexing.

Private Sub ListControlsBtt n_Click()
Dim i As Integer, intHowmany As Integer, WhichForm As String

Msg = "Enter form name."
Title = "Form Name?"
Defvalue = "frmListThi ngs"
WhichForm = InputBox$(Msg, Title, Defvalue)
If WhichForm = "" Then Exit Sub
For i = 0 To Forms(WhichForm ).Count - 1
intHowmany = intHowmany + 1
Debug.Print intHowmany; ") "; Forms(WhichForm )(i).Name
Next i

End Sub
Jun 1 '06 #1
4 2113
MLH wrote:
I seem to remember the code below working before.
But, today, it is not. Instead, I get a 2450 error complaining
that it cannot find the named form. This is true regardless
of which form name I enter. Is perplexing.


2450 shows up when Access can't find that particular form when it is open.

For example, something like:

msgbox Forms.frmV.capt ion

will raise 2450 if frmV is not open, even if it is a legitimate form.

The reason you code is failing is because, I would imagine, the form
name you enter is of a form that is not open. The Forms collection
refers to all of the currently _OPEN_ forms in a Microsoft Access database.

Off the bat, I'm not sure how you'd refer to the forms in an mdb that
were closed. Probably through a select statement on the msysobjects or
similar table.

HTH! 8)
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Jun 1 '06 #2
MLH
<snip>
The reason you code is failing is because, I would imagine, the form
name you enter is of a form that is not open. The Forms collection
refers to all of the currently _OPEN_ forms in a Microsoft Access database.

Off the bat, I'm not sure how you'd refer to the forms in an mdb that
were closed. Probably through a select statement on the msysobjects or
similar table.

Sure enough, you're right. I must-a-been working on this project and
dropped it in an unfinished state. I suppose I could open the form
using the acDesign and acHidden parms and walk the controls collection
while the form was open, closing it when done.

Unless someone suggests a better idea here, will do that. Meanwhile,
seeking further comments...

Jun 1 '06 #3
MLH
Unless someone has a more elegant approach, I tried
the following and it works...

100 Msg = "Enter form name."
110 Title = "Form Name?"
120 Defvalue = "frmListThi ngs"
130 WhichForm = InputBox$(Msg, Title, Defvalue)
140 DoCmd.OpenForm WhichForm, acDesign, , , , acHidden
150 If WhichForm = "" Then Exit Sub
160 For i = 0 To Forms(WhichForm ).Count - 1
170 intHowmany = intHowmany + 1
180 Debug.Print intHowmany; ") "; Forms(WhichForm )(i).Name
190 Next i
200 DoCmd.Close acForm, WhichForm, acSaveNo

Jun 1 '06 #4
* MLH:
Unless someone has a more elegant approach, I tried
the following and it works...

100 Msg = "Enter form name."
110 Title = "Form Name?"
120 Defvalue = "frmListThi ngs"
130 WhichForm = InputBox$(Msg, Title, Defvalue)
140 DoCmd.OpenForm WhichForm, acDesign, , , , acHidden
150 If WhichForm = "" Then Exit Sub
160 For i = 0 To Forms(WhichForm ).Count - 1
170 intHowmany = intHowmany + 1
180 Debug.Print intHowmany; ") "; Forms(WhichForm )(i).Name
190 Next i
200 DoCmd.Close acForm, WhichForm, acSaveNo


I'd put the check for no value entered (line 150) ahead of the open
(line 140). I'd also add some error trapping in case the user enters a
"WhichForm" which isn't actually the name of a form.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Jun 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4742
by: Wayne Aprato | last post by:
What can cause Access to bring up Runtime Error 2450 saying that it can't find a particular form when the form is definitely open? I am opening the form and then checking if fields are populated to determine whether labels in a report that is subsequently opened are visible or not. Part of the code for the "On Open" event of the report follows: If IsNull(Forms!Details!Name2) Then Me.Name2Lbl.Visible = False If...
11
4220
by: MLH | last post by:
Private Sub ButtonP_Click() On Error GoTo Err_ButtonP_Click Dim ThisForm As String ThisForm = Me.Name Exit_ButtonP_Click: Exit Sub Err_ButtonP_Click: Dim r As String, k As String, Message3 As String
1
4369
by: andykevans | last post by:
Hi Guys, Pretty much a novice at Access so I apologise if this is obvious: I have an Access form called MainForm1. On the form is an execute button which starts a vb script. The script runs along nicely importing lots of records using the docmd.transfertext command. It then, at random points in the records, will return the above 2450 error saying it can't find the MainForm1, even though it's open and the only form in the database with no...
2
14248
by: PW | last post by:
Hi, What the heck is that supposed to mean? I am getting this error on a "Me.Requery" line in a subroutine on a form, but only when I select something from a combo/dropdown box. The *exact* same code is run when I do other things (like press the Save button or tab through that control). I have searched every control, involved queries and tables and I can't find anything that looks fishy.
1
5183
by: phoebus | last post by:
Hi, I am trying to fix an access database for someone. They are having an issue on a particular form when entering data. When any character gets typed into the form, the below error gets displayed: Run-time error '2450' Microsoft Office Access can't find the form 'Create form 471' referred to in a macro expression or Visual Basic code.
17
2288
by: MLH | last post by:
I have tested the following in immed window: ?isnumeric(1) True ?isnumeric(1.) True ?isnumeric(1.2) True ?isnumeric(1.2.2)
2
19474
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
10
6971
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
26
6923
mseo
by: mseo | last post by:
hi, I am developing a form for adding employees where you can find three fields in the table employees (firstname, middlename, lastname, hiredate (Is Not Null) and ADezii prompt me to use this code and it gives me the msgboxes which I need to be viewed to the user but after that It gives me an error because the code which I used for save cmdbutton is private sub save_click() docmd.save docmd.requery (the error because of this I think)...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.