Problems when referencing a closed form

P

paul.schrum

Access 2002
The problem I am about to describe can be worked around (via On Error
Goto), but I would still like to understand why this does not work or
how I can do I what want to do without resorting to On Error Goto

I am trying to reference a form that is opened sometimes and closed
other times. Here is my code:

Dim aLbx As ListBox
Dim aFrm As Form

strng = getAllSelectedKeys

Set aFrm = Application.Forms!frm_selectKeyNumber
If Not aFrm Is Nothing Then
Set aLbx = aFrm.Controls(9)
aLbx.RowSource = strng
End If

On the line "Set aFrm = ...", it gives me the message

Runtime error '2450' ... can't find the form 'frm_selectKeyNumber'
refered to ...

What is the recommended way to check to see whether a form is available
to refer to without crashing the routine?

Two Notes: I pasted the name of the form into the module straight from
the Forms object window. This has been working for a few weeks now. I
can not imagine what I did to break it.

- Paul
 
P

PC Datasheet

Paul,

Try this ----------

Dim aLbx As ListBox

strng = getAllSelectedKeys

If SysCmd(acSysCmdGetObjectState, acForm, "frm_selectKeyNumber") = 0 Then
Exit Sub
End If
Set aLbx = Forms!frm_selectKeyNumber.Controls(9)
aLbx.RowSource = strng

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Contact me.
 
P

paul.schrum

Whoever you are,

Thanks for your recommendation. That did what I need.

- Paul
 
P

PC Datasheet

Paul,

I am in business to provide Access users a resource for help with Access
applications. My fees are very reasonable. In the past several years, over
1000 Access users from the newsgroups have contacted me requesting help with
their database applications. If you ever need help, please contact me at my
email address below.

Steve

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Contact me.
 
J

John Marshall, MVP

Nice job in cancelling the good will you created in the message he replied
to.

These newsgroups were provided by Microsoft for free peer to peer support,
not as a means for you to make money. These newsgroups are filled with
better qualified Access developers, who have the professionalism to respect
the spirit of these newsgroups.

John... Visio MVP
 
P

paul.schrum

John,

You have a good point, but I would not jump on him quite so hard sinceI
addressed him as "whoever you are." He probably took that as a cue to
introduce himself (but I still don't have even a first name to use for
him.)

At the same time, the subtlety of just putting one's url in one's sig
is nice. I visited his web site before my response to him, so I knew
he was in consulting without the more verbose explanation within this
thread.

- Paul
 
P

PC Datasheet

Paul,

If you look closely, my name is right under my message in my previous
response to you.

Steve

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Contact me.
 
J

John Marshall, MVP

Thanks Paul.

Unfortunately, steve santos AKA PC datasheet, has been abusing the free
nature of these newsgroup for a long time.

Rather than take your message as a compliment, he chose to turn it into an
oppurtunity to solicit work. A simple thank would have been more
appropriate.

Most of us have no problem with a URL in the sig line, but steve tends to go
beyond that. The issue of solicitation is not within the sig line, but the
body of the message. In this case, he did not acknowledge your compliment,
but chose to indicate he was in business at reasonable rates.

John... Visio MVP
 
J

John Marshall, MVP

You should reread your own message, your name is missing.

John... Visio MVP
 
P

paul.schrum

Steve,

Sorry about that. It was one of those things where I was reading too
fast. (Got forms to turn out, you know.)

- Paul
 
P

PC Datasheet

No problem!

BTW, did you get your primary key problem fixed?

The only time you get this:
rst.RecordCount is equal to -1
is when you first open a recordset and immediately execute this statement.
If you want the true recordcount you need to precede this statement with:
Rst.Movelast

Another comment --- I don't know what you are doing but most likely you
should be using DAO.

Let me know if you need help. (No charge!)

Steve
 
J

John Marshall, MVP

PC Datasheet said:
Your a venomous jerk!!!!

See Paul's response.


I did, but he was taking you at your word. You said your name was on the
post and he believed you. The only name in your post was Paul's. So since
you can not dispute the facts, you choose to insult?

So should I add this to the long list of apologies you will never make?

John... Visio MVP
 
P

paul.schrum

Steve,
BTW, did you get your primary key problem fixed?

I put my response to this question of yours over in the thread "Primary
Key value from record added programmatically."

I did that in case I ever do a google search for it again. Your answer
is good, but I would likely have not found it here in this thread about
referencing a closed form.

See ya over there.

- Paul
 
P

PC Datasheet

You're not only a venomous jerk, you're also a venomous boldface liar.
You're a disgrace to all MVPs!!!!
 
P

paul.schrum

Unfortunately, steve santos AKA PC datasheet, has been abusing the free
nature of these newsgroup for a long time.

John,

Nothing personal here, but I just don't have a dog in this fight. For
my part, I plan to be cordial to Steve Santos and to you.

So although it is interesting to watch, I'm not going to take sides in
something where I don't know the history or background.

- Paul
 
S

StopThisAdvertising

PC Datasheet said:
You're not only a venomous jerk, you're also a venomous boldface liar.
You're a disgrace to all MVPs!!!!

Nice put Steve !! (Projection again ..., btw did you look this up ??)

This *all* applies to you Steve, except of course for the MVP-part ...
But you are a disgrace indeed.

Arno R
 

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

Top