dbTalk Databases Forums  

OpenForm error: Access 2007/2010

comp.databases.ms-access comp.databases.ms-access


Discuss OpenForm error: Access 2007/2010 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Salad
 
Posts: n/a

Default Re: OpenForm error: Access 2007/2010 - 08-26-2010 , 07:13 PM






David W. Fenton wrote:

Quote:
Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:i82dnQgpp4sS7ejRnZ2dnUVZ_sqdnZ2d (AT) earthlink (DOT) com:


Returns True if I use a drive letter. C:, X:. Same if I
add the path. False on folder and filename.


Er, what? It should work for folders and not with filename (if you
read the actual content of the function, including the parameter
name, this should be obvious).

What I said.

Reply With Quote
  #22  
Old   
Mark
 
Posts: n/a

Default Re: OpenForm error: Access 2007/2010 - 08-27-2010 , 07:04 AM






On Aug 26, 4:53*pm, "David W. Fenton" <NoEm... (AT) SeeSignature (DOT) invalid>
wrote:
Quote:
Mark <cmd2... (AT) frontiernet (DOT) net> wrote innews:4f002f39-b3b5-419d-9bdb-23c50e55d2dd (AT) j8g2000yqd (DOT) googlegroups.com
:





On Aug 25, 5:23*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Mark wrote:
On Aug 25, 3:35 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

Mark wrote:

On Aug 25, 3:13 pm, "David W. Fenton"
NoEm... (AT) SeeSignature (DOT) invalid> wrote:

Mark <cmd2... (AT) frontiernet (DOT) net> wrote
innews:46c7d84a-3b63-4baa-87c0-5
20fb0615... (AT) 5g2000yqz (DOT) googlegroups.com:

Having said all that, I recognize your expertise, so I would
like to replace Dir() with your function. Do I simply
copy/paste your function into my form and then replace "If
Len(Dir(ServerRomney))

0 Then" with:

"If CheckForNetwork(ServerRomney) Then"

Yes -- that's all you have to do.

I'd suggest pasting the function into a public module,
instead of into the form module, so you can use it elsewhere
should you decide it's useful.

--
David W. Fenton * * * * * * * * *http://www.dfenton
.com/
contact via website only * *http://www.dfenton.com/DFA/

Thanks David,
I was just now trying this out. I first pasted the function in
a form's module and then tried:
?CheckForNetwork("C:\Access97\fpsdata.mdb") in the Immediate
window.
I got an error: "undefined sub or function". I then pasted the
code into a public function (removing the word "Private") and
did the ? CheckForNetwork("C:\Access97\fpsdata.mdb") again in
the Immediate window. This time it reported "False". I had
been expecting "True". Am I missing something?
Mark

Works for me. *Returns True if I use a drive letter. *C:, X:.
*Sa
me if I
add the path. False on folder and filename.- Hide quoted text -

- Show quoted text -

Yes, Salad, same for me (but I'm not sure what you mean by
"path"). I get the following results:
?CheckForNetwork("C:\") and ?CheckForNetwork("P:\") = True
?CheckForNetwork("C:\Access97") and
?CheckForNetwork("P:\Access97") False
?CheckForNetwork("C:\Access97\fpsdata.mdb") and
?CheckForNetwork("P: \Access97\fpsdata.mdb") = False

C:, Y:, works
D:\Test or D:\Test\ works
D:\Test\Test.mdb doesn't.

Path are the folders. *C:\Test1\Test2\Test3 is a folder path
IMO.- Hide
*quoted text -

- Show quoted text -

Thanks, Salad
At least on your system, the code works for identifying the
existance of a folder (D:\Test).

This is by design -- the code was written to check for the existence
of a FOLDER. If you read the code, that's quite clear.

If you want to change it to check for a file, change:

* CheckForNetwork = objFSO.FolderExists(strFolderToCheck)

...to:

* CheckForNetwork = objFSO.FileExists(strFolderToCheck)

I don't think I'd alter this particular function, but create a new
one that does the same thing, like this:

Public Function CheckForFile(strFileToCheck As String, _
* * *Optional bolClear As Boolean = False) As Boolean
* Static objFSO As Object

* If bolClear Then Set objFSO = Nothing: Exit Function

* If objFSO Is Nothing Then
* * *Set objFSO = CreateObject("Scripting.FileSystemObject")
* End If
* CheckForFile = objFSO.FileExists(strFileToCheck)
End Function

This will check for the existence of the file instead of for the
existence of a folder.

[]

... I was able to do some more testing on the main problem. On an
Access2007/Win7 computer which had just been rebooted, I clicked
the button to open the form in question and there was a delay of
approximately 15 seconds. When I moved the cursor above the Access
window it turned into the spinning hourglass. Otherwise, it looks
like nothing is happening, plus I think the delay may be even
longer on some Access2007/Win7 computers. Opening a "Please wait"
popup form might be useful.

Why don't you put some Debug.Print Now() statements in the code
that's opening the form (e.g., the form's OnOpen event, for
instance).

Anyhow, once I waited long enough for the form to open, I could
now open and close the form at will and each time the form would
open with no delay at all. Same if I closed and reopened the
database -- no delay in opening the form. I also closed that
database and opened a mirror copy of the FE, but which is linked
to a different BE. When I tried to open the form on that FE it
also opened immediately.

What code is running when that form opens?

Is the form bound or unbound?

I thought I had it figured out -- that something in Win7 and/or
Access 2007 had to be initialized each time the computer is
restarted in order for that particular bit of code to work --
Len(Dir(path)). So, I restarted the computer, opened the database
and, guess what, the form opens immediately the first time I click
the button. Go figure.

That was my guess, too, that the network initialization was the
cause of the slowdown, and I thought the File System Object network
functions were more efficient. I provided a non-equivalent function,
though.

I wonder if you rebooted the "server" if you'd have the same time
delay opening the form.

--
David W. Fenton * * * * * * * * *http://www.dfenton.com/
contact via website only * *http://www.dfenton.com/DFA/- Hide quoted text -

- Show quoted text -
Thank you, David, for your patience and for the CheckForFile function.
Maybe rebooting the "server" would help, but I've never seen this
problem with any of the laptops running WinXP and Access 97 or 2002.
Also, the problem on the Win7/Access2007/2010 laptops immediately
disappears (temporarily, at least) when the FE is replaced -- and
without doing anything to the "server". That still makes me think it's
something to do with Win7 and/or Access2007/2010.
Meanwhile, I've put in a "Please wait" popup just so the user doesn't
think nothing's happening.
To answer your questions, the form that opens is an unbound form. The
only code that's running is in the OpenForm event and sets a number of
textboxes to visible-no. The command button that opens the form first
makes sure the user is not already linked to the "server" and, if not,
then makes sure that the appropriate BE is located on the "server". (I
use the same FE for two regions and just link to the appropriate BE
prior to distributing revised FE's).

Reply With Quote
  #23  
Old   
David W. Fenton
 
Posts: n/a

Default Re: OpenForm error: Access 2007/2010 - 08-27-2010 , 01:55 PM



Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:asmdnZseNuXcnurRnZ2dnUVZ_sGdnZ2d (AT) earthlink (DOT) com:

Quote:
David W. Fenton wrote:

Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:i82dnQgpp4sS7ejRnZ2dnUVZ_sqdnZ2d (AT) earthlink (DOT) com:

Returns True if I use a drive letter. C:, X:. Same if I
add the path. False on folder and filename.

Er, what? It should work for folders and not with filename (if
you read the actual content of the function, including the
parameter name, this should be obvious).

What I said.
....but not what I *read*...

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.