473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 ListControlsBttn_Click()
Dim i As Integer, intHowmany As Integer, WhichForm As String

Msg = "Enter form name."
Title = "Form Name?"
Defvalue = "frmListThings"
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 2093
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.caption

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 = "frmListThings"
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 = "frmListThings"
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
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...
11
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...
1
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...
2
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*...
1
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...
17
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
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...
10
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...
26
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.