473,414 Members | 1,848 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,414 software developers and data experts.

Can't Get Echo To Work

I need to temporarily remove the recordset from my form while I run some
queries (have locking problems). So I turned Echo off before removing the
recordset to avoid getting #Name? in the bound controls. However, even
though I turned Echo off, I'm still getting #Name? until I reset the
recordset. Here's the code I'm using:

DoCmd.Hourglass True
Application.Echo False
Me.RecordSource = ""
<run queries here>
<reset recordsource here>

Anything I'm doing wrong here? (I've also tried DoCmd.Echo False, even
though OLH recommends using Application.Echo.)

Thanks,

Neil
Nov 13 '05 #1
11 5170
Instead of removing the recordset, just force a save or undo:
If Me.Dirty Then
Me.Dirty = False ' Me.Undo
End If
That should solve the locking problem.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Neil" <no****@nospam.net> wrote in message
news:cU***************@newsread1.news.pas.earthlin k.net...
I need to temporarily remove the recordset from my form while I run some
queries (have locking problems). So I turned Echo off before removing the
recordset to avoid getting #Name? in the bound controls. However, even
though I turned Echo off, I'm still getting #Name? until I reset the
recordset. Here's the code I'm using:

DoCmd.Hourglass True
Application.Echo False
Me.RecordSource = ""
<run queries here>
<reset recordsource here>

Anything I'm doing wrong here? (I've also tried DoCmd.Echo False, even
though OLH recommends using Application.Echo.)

Thanks,

Neil

Nov 13 '05 #2
No, it won't. I do do a save before running my queries, but to no avail.
These are SQL queries run as pass-throughs, and, for some reason, this form,
which is a form and a subform, is putting a lock on the table and not
allowing the SPs to run.

So, back to this situation, Echo is supposed to freeze screen updating, and
removing the recordset after Echo = False should not result in any updating.
And I seem to remember using it in the past this way with good results. But
can't get this to work for some reason.

Neil
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Instead of removing the recordset, just force a save or undo:
If Me.Dirty Then
Me.Dirty = False ' Me.Undo
End If
That should solve the locking problem.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Neil" <no****@nospam.net> wrote in message
news:cU***************@newsread1.news.pas.earthlin k.net...
I need to temporarily remove the recordset from my form while I run some
queries (have locking problems). So I turned Echo off before removing the
recordset to avoid getting #Name? in the bound controls. However, even
though I turned Echo off, I'm still getting #Name? until I reset the
recordset. Here's the code I'm using:

DoCmd.Hourglass True
Application.Echo False
Me.RecordSource = ""
<run queries here>
<reset recordsource here>

Anything I'm doing wrong here? (I've also tried DoCmd.Echo False, even
though OLH recommends using Application.Echo.)

Thanks,

Neil


Nov 13 '05 #3
Neil wrote:
I need to temporarily remove the recordset from my form while I run some
queries (have locking problems). So I turned Echo off before removing the
recordset to avoid getting #Name? in the bound controls. However, even
though I turned Echo off, I'm still getting #Name? until I reset the
recordset. Here's the code I'm using:

DoCmd.Hourglass True
Application.Echo False
Me.RecordSource = ""
<run queries here>
<reset recordsource here>

Anything I'm doing wrong here? (I've also tried DoCmd.Echo False, even
though OLH recommends using Application.Echo.)

Thanks,

Neil


Echo only refers to the status bar text AFAIK.

The code (below my sig) is from a test form with a few textboxes and two
buttons (button names in _click procedures). You should be able to adapt
that to your needs, basically it saves all the controlsources of the
controls befor unbinding the form, the second button puts them all back
on again.

--
[OO=00=OO]
Option Compare Database
Option Explicit

Dim mstrRecordSource As String
Dim mstrCtlSrc() As String

Private Sub Form_Open(Cancel As Integer)
mstrRecordSource = Me.RecordSource
End Sub
Private Sub cmdUnBound_Click()
Dim i As Long
ReDim mstrCtlSrc(Me.Controls.Count)

On Error Resume Next
' cause some of these WILL error unless you
' check their type, etc, long winded
For i = 0 To Me.Controls.Count - 1
mstrCtlSrc(i) = Me.Controls(i).ControlSource
Me.Controls(i).ControlSource = ""
Next
Me.RecordSource = ""

End Sub

Private Sub cmdBound_Click()
Dim i As Long

On Error Resume Next
Me.RecordSource = mstrRecordSource
For i = 0 To Me.Controls.Count - 1
Me.Controls(i).ControlSource = mstrCtlSrc(i)
Next
End Sub
Nov 13 '05 #4
Neil wrote:
No, it won't. I do do a save before running my queries, but to no avail.
These are SQL queries run as pass-throughs, and, for some reason, this form,
which is a form and a subform, is putting a lock on the table and not
allowing the SPs to run.


I generally find moving to a new record is sufficient, have you tried
that before anything more drastic?
--
[OO=00=OO]
Nov 13 '05 #5
Nope, that didn't work. For some reason, the form itself is putting a lock
on the whole table. Moving to the previous record didn't help. (Plus, it
seems confusing to the user that, while the queries are being run related to
the current record, that they're seeing a different record in the form, and
they might think that they clicked the button to run the queries while in
the wrong record.)

Someone else recommended setting the recordsource to a non-existent record
(ID=0), and that seems to work OK. I end up with a blank screen, but there
are no locks and no #Name?'s.

Thanks,

Neil
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...
Neil wrote:
No, it won't. I do do a save before running my queries, but to no avail.
These are SQL queries run as pass-throughs, and, for some reason, this
form, which is a form and a subform, is putting a lock on the table and
not allowing the SPs to run.


I generally find moving to a new record is sufficient, have you tried that
before anything more drastic?
--
[OO=00=OO]

Nov 13 '05 #6
> Echo only refers to the status bar text AFAIK.

No, I believe it refers to the whole screen. MS Help talks about being
locked out of an app if you turn echo off, but don't turn it back on, and
recommend having a shortcut key to turn it back on in case your code exits
without doing so. So I'm pretty sure it's a whole screen thing (and my use
of it in the past agrees with that, though I haven't used it in years).

The code (below my sig) is from a test form with a few textboxes and two
buttons (button names in _click procedures). You should be able to adapt
that to your needs, basically it saves all the controlsources of the
controls befor unbinding the form, the second button puts them all back on
again.

Hmm, well that's interesting. That would certainly be the best way to go.
Thanks for taking the time to do that!

Neil
--
[OO=00=OO]
Option Compare Database
Option Explicit

Dim mstrRecordSource As String
Dim mstrCtlSrc() As String

Private Sub Form_Open(Cancel As Integer)
mstrRecordSource = Me.RecordSource
End Sub
Private Sub cmdUnBound_Click()
Dim i As Long
ReDim mstrCtlSrc(Me.Controls.Count)

On Error Resume Next
' cause some of these WILL error unless you
' check their type, etc, long winded
For i = 0 To Me.Controls.Count - 1
mstrCtlSrc(i) = Me.Controls(i).ControlSource
Me.Controls(i).ControlSource = ""
Next
Me.RecordSource = ""

End Sub

Private Sub cmdBound_Click()
Dim i As Long

On Error Resume Next
Me.RecordSource = mstrRecordSource
For i = 0 To Me.Controls.Count - 1
Me.Controls(i).ControlSource = mstrCtlSrc(i)
Next
End Sub

Nov 13 '05 #7
Be sure that the form's Record Locking property is set to No Locks.

--

Ken Snell
<MS ACCESS MVP>

"Neil" <no****@nospam.net> wrote in message
news:3L*****************@newsread2.news.pas.earthl ink.net...
Nope, that didn't work. For some reason, the form itself is putting a lock
on the whole table. Moving to the previous record didn't help. (Plus, it
seems confusing to the user that, while the queries are being run related
to the current record, that they're seeing a different record in the form,
and they might think that they clicked the button to run the queries while
in the wrong record.)

Someone else recommended setting the recordsource to a non-existent record
(ID=0), and that seems to work OK. I end up with a blank screen, but there
are no locks and no #Name?'s.

Thanks,

Neil
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...
Neil wrote:
No, it won't. I do do a save before running my queries, but to no avail.
These are SQL queries run as pass-throughs, and, for some reason, this
form, which is a form and a subform, is putting a lock on the table and
not allowing the SPs to run.


I generally find moving to a new record is sufficient, have you tried
that before anything more drastic?
--
[OO=00=OO]


Nov 13 '05 #8
Neil wrote:
Echo only refers to the status bar text AFAIK.

No, I believe it refers to the whole screen. MS Help talks about being
locked out of an app if you turn echo off, but don't turn it back on, and
recommend having a shortcut key to turn it back on in case your code exits
without doing so. So I'm pretty sure it's a whole screen thing (and my use
of it in the past agrees with that, though I haven't used it in years).


In that case it's broken then :-)

--
[OO=00=OO]
Nov 13 '05 #9
It's a SQL back end, so the record locking property has no effect. But,
FWIW, it is set to no locks.

"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:ea**************@TK2MSFTNGP14.phx.gbl...
Be sure that the form's Record Locking property is set to No Locks.

--

Ken Snell
<MS ACCESS MVP>

"Neil" <no****@nospam.net> wrote in message
news:3L*****************@newsread2.news.pas.earthl ink.net...
Nope, that didn't work. For some reason, the form itself is putting a
lock on the whole table. Moving to the previous record didn't help.
(Plus, it seems confusing to the user that, while the queries are being
run related to the current record, that they're seeing a different record
in the form, and they might think that they clicked the button to run the
queries while in the wrong record.)

Someone else recommended setting the recordsource to a non-existent
record (ID=0), and that seems to work OK. I end up with a blank screen,
but there are no locks and no #Name?'s.

Thanks,

Neil
"Trevor Best" <no****@besty.org.uk> wrote in message
news:42**********************@news.zen.co.uk...
Neil wrote:
No, it won't. I do do a save before running my queries, but to no
avail. These are SQL queries run as pass-throughs, and, for some
reason, this form, which is a form and a subform, is putting a lock on
the table and not allowing the SPs to run.

I generally find moving to a new record is sufficient, have you tried
that before anything more drastic?
--
[OO=00=OO]



Nov 13 '05 #10
RD
On Tue, 19 Jul 2005 08:34:56 +0100, Trevor Best <no****@besty.org.uk> wrote:
Neil wrote:
I need to temporarily remove the recordset from my form while I run some
queries (have locking problems). So I turned Echo off before removing the
recordset to avoid getting #Name? in the bound controls. However, even
though I turned Echo off, I'm still getting #Name? until I reset the
recordset. Here's the code I'm using:

DoCmd.Hourglass True
Application.Echo False
Me.RecordSource = ""
<run queries here>
<reset recordsource here>

Anything I'm doing wrong here? (I've also tried DoCmd.Echo False, even
though OLH recommends using Application.Echo.)

Thanks,

Neil


Echo only refers to the status bar text AFAIK.

<snip>

That's true of the DoCmd object but the Echo method of the Application object is
supposed to freeze screen repainting.

Example from Help:

The following example uses the Echo method to prevent the screen from being
repainted while certain operations are underway. While the procedure opens a
form and minimizes it, the user only sees an hourglass icon indicating that
processing is taking place, and the screen isn't repainted. When this task is
completed, the hourglass changes back to a pointer and screen repainting is
turned back on.

Public Sub EchoOff()

' Open the Employees form minimized.
Application.Echo False
DoCmd.Hourglass True
DoCmd.OpenForm "Employees", acNormal
DoCmd.Minimize
Application.Echo True
DoCmd.Hourglass False

End Sub

Nov 13 '05 #11
RD wrote:
On Tue, 19 Jul 2005 08:34:56 +0100, Trevor Best <no****@besty.org.uk> wrote:
Echo only refers to the status bar text AFAIK.


<snip>

That's true of the DoCmd object but the Echo method of the Application object is
supposed to freeze screen repainting.


Ah. I see.

I would have called it Application.ScreenUpdating like the rest of
Office VBA.

There's nothing like consistency, and that's nothing like consistency :-)

--
[OO=00=OO]
Nov 13 '05 #12

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

Similar topics

5
by: The Biscuit Eater | last post by:
Greetings from a second day newbie to php. I think I have figured out a way to explode a field in a csv file (like 11-08-03) and implode it as 031108 and then compare it to the current date(ymd)...
20
by: Wilfred Johnson | last post by:
I have a little simple hit counter. It works if I replace $cnt++; with #cnt = $cnt + 1; I can't see why this doesn't work. Any ideas? if(file_exists("counter.dat")) { $f =...
7
by: deko | last post by:
I populate a drop-down list like this: echo "<select>"; foreach ( $ip_list as $var ) { echo "<option>"; echo $var; echo "</option>"; } echo "</select>";
6
by: pam | last post by:
sorry for my poor english first. $notation=$rs->fields; if(!empty($notation)) echo $notation; the notation field in database is a text type, when the value is null, it will cause a mistake;...
11
by: sk | last post by:
According to zend.com Double and single quoted strings are handled differently by PHP. Double quoted strings are interpreted while single quoted strings are treated exactly as written. For...
27
by: DavidPr | last post by:
I've been working on this script all day with no luck at all. I have to successfully test both parts of this script in order to finish this project. I haven't tested the delete part yet, because I...
10
by: evicailieva | last post by:
A have a php scrip where I call a JavaScript function. I don't know why, but it doesn't work. At the beginning, when I was writing the script it was working but now it's not. I don't know wхat to do....
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
4
elen
by: elen | last post by:
hi! I wish for your help! I have a form and i want to store the results to my database and show me back what i sent to database,but my php script won't work.Can somebody help me ?I'm new in php ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.