Requery on command button not working

G

Guest

I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 
G

Guest

Hi, Steve.
First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.
not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.
Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
G

Guest

The calculation message is on permanently, and the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it. It is the first time in some 50
forms I have built that this has occurred.
When I attempt to use the command button to display the previous period the
screen just freezes out completely even with your suggested code. This
indicates some other problem I cannot figure out. The form is built on a
temporary table that is already populated prior to invoking and has only 160
rows currently.



'69 Camaro said:
Hi, Steve.
First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.
not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.
Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 
G

Guest

Hi, Steve.

Please post the VBA for the command button, GetYear( ) and GetPeriod( )
functions, the Record Source of the form (if this is defined in the pop-up
form, then post that VBA call), and the data types of any relevant fields.
Is there a subform involved? Are these calculations coming from "across the
network" (i.e., development on a file not on your own workstation)? Is this
a shared database? Is Auto Name Correct turned on? Are subdatasheets turned
on for this table or any related tables?
the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it.

One way to test this is to make a copy of the form and remove this
conditional formatting from the copy, then use the copy to see whether the
"Calculating..." still takes too long.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
The calculation message is on permanently, and the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it. It is the first time in some 50
forms I have built that this has occurred.
When I attempt to use the command button to display the previous period the
screen just freezes out completely even with your suggested code. This
indicates some other problem I cannot figure out. The form is built on a
temporary table that is already populated prior to invoking and has only 160
rows currently.



'69 Camaro said:
Hi, Steve.
First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.
not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.
Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 
G

Guest

Removal of the Conditional formatting speeds up the whole process and
everything works ok. Only problem now is that the need to colour fields red
when less than another figure is not possible.

In the Conditional formatting all I had done was use
'Expression is'
with a condition of for 1 example
[txtBaseActual]>[txtBaseNo]
and made it red and bold

This appears to be the root of the problem as I tried puting just one
conditional statement back on and the 'Calculating ...' message stays on
screen indefinately.

How do I code around this problem or am I stuck with it?

Cheers,
Steve
'69 Camaro said:
Hi, Steve.

Please post the VBA for the command button, GetYear( ) and GetPeriod( )
functions, the Record Source of the form (if this is defined in the pop-up
form, then post that VBA call), and the data types of any relevant fields.
Is there a subform involved? Are these calculations coming from "across the
network" (i.e., development on a file not on your own workstation)? Is this
a shared database? Is Auto Name Correct turned on? Are subdatasheets turned
on for this table or any related tables?
the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it.

One way to test this is to make a copy of the form and remove this
conditional formatting from the copy, then use the copy to see whether the
"Calculating..." still takes too long.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
The calculation message is on permanently, and the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it. It is the first time in some 50
forms I have built that this has occurred.
When I attempt to use the command button to display the previous period the
screen just freezes out completely even with your suggested code. This
indicates some other problem I cannot figure out. The form is built on a
temporary table that is already populated prior to invoking and has only 160
rows currently.



'69 Camaro said:
Hi, Steve.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.

not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.

Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


:

I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 
G

Guest

How do I code around this problem or am I stuck with it?

Of course you aren't stuck with it. In the form's OnCurrent( ) event and
the text box's OnAfterUpdate( ) event, try:

If (Me!txtBaseActual > Me!txtBaseNo) Then
Me!txtBaseNo.FontWeight = 700
Me!txtBaseNo.ForeColor = vbRed
Else
Me!txtBaseNo.FontWeight = 400
Me!txtBaseNo.ForeColor = vbBlack
End If

.. . . or use txtBaseActual for the varied font weights and fore colors, if
that's the text box that needs the color formatting.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
Removal of the Conditional formatting speeds up the whole process and
everything works ok. Only problem now is that the need to colour fields red
when less than another figure is not possible.

In the Conditional formatting all I had done was use
'Expression is'
with a condition of for 1 example
[txtBaseActual]>[txtBaseNo]
and made it red and bold

This appears to be the root of the problem as I tried puting just one
conditional statement back on and the 'Calculating ...' message stays on
screen indefinately.

How do I code around this problem or am I stuck with it?

Cheers,
Steve
'69 Camaro said:
Hi, Steve.

Please post the VBA for the command button, GetYear( ) and GetPeriod( )
functions, the Record Source of the form (if this is defined in the pop-up
form, then post that VBA call), and the data types of any relevant fields.
Is there a subform involved? Are these calculations coming from "across the
network" (i.e., development on a file not on your own workstation)? Is this
a shared database? Is Auto Name Correct turned on? Are subdatasheets turned
on for this table or any related tables?
the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it.

One way to test this is to make a copy of the form and remove this
conditional formatting from the copy, then use the copy to see whether the
"Calculating..." still takes too long.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
The calculation message is on permanently, and the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it. It is the first time in some 50
forms I have built that this has occurred.
When I attempt to use the command button to display the previous period the
screen just freezes out completely even with your suggested code. This
indicates some other problem I cannot figure out. The form is built on a
temporary table that is already populated prior to invoking and has only 160
rows currently.



:

Hi, Steve.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.

not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.

Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


:

I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 
G

Guest

OnCurrent() colours all rows red if the 1st row value tested is true or all
black if false.
AfterUpdate on text field appears to have no effect as the data is only
being populated at load and not changed within the form.
I need an event that passes through each row in turn to individually switch
on Red for each field within the row that passes the test.
This is why I was using Conditional Fromatting to affect only those rows
that passed the test as true, as this would appear to be the correct way of
doing things in Access. Please excuse my ignorance on this, I have come from
an Oracle background and some things seem extraordinarily complicated to
achieve in Access.

I do not follow what you are sugggesting with this :-
.. . . or use txtBaseActual for the varied font weights and fore colors, if
that's the text box that needs the color formatting

Many thanks for your patience on this.

Cheers,
Steve
'69 Camaro said:
How do I code around this problem or am I stuck with it?

Of course you aren't stuck with it. In the form's OnCurrent( ) event and
the text box's OnAfterUpdate( ) event, try:

If (Me!txtBaseActual > Me!txtBaseNo) Then
Me!txtBaseNo.FontWeight = 700
Me!txtBaseNo.ForeColor = vbRed
Else
Me!txtBaseNo.FontWeight = 400
Me!txtBaseNo.ForeColor = vbBlack
End If

. . . or use txtBaseActual for the varied font weights and fore colors, if
that's the text box that needs the color formatting.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


Ace9x said:
Removal of the Conditional formatting speeds up the whole process and
everything works ok. Only problem now is that the need to colour fields red
when less than another figure is not possible.

In the Conditional formatting all I had done was use
'Expression is'
with a condition of for 1 example
[txtBaseActual]>[txtBaseNo]
and made it red and bold

This appears to be the root of the problem as I tried puting just one
conditional statement back on and the 'Calculating ...' message stays on
screen indefinately.

How do I code around this problem or am I stuck with it?

Cheers,
Steve
'69 Camaro said:
Hi, Steve.

Please post the VBA for the command button, GetYear( ) and GetPeriod( )
functions, the Record Source of the form (if this is defined in the pop-up
form, then post that VBA call), and the data types of any relevant fields.
Is there a subform involved? Are these calculations coming from "across the
network" (i.e., development on a file not on your own workstation)? Is this
a shared database? Is Auto Name Correct turned on? Are subdatasheets turned
on for this table or any related tables?

the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it.

One way to test this is to make a copy of the form and remove this
conditional formatting from the copy, then use the copy to see whether the
"Calculating..." still takes too long.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


:

The calculation message is on permanently, and the form is doing nothing
other than some conditional formatting on about 7 fields (there are some 50
rows displayed however). The screen displays quite quickly on entry so I
don't think it can be that that causes it. It is the first time in some 50
forms I have built that this has occurred.
When I attempt to use the command button to display the previous period the
screen just freezes out completely even with your suggested code. This
indicates some other problem I cannot figure out. The form is built on a
temporary table that is already populated prior to invoking and has only 160
rows currently.



:

Hi, Steve.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen

The CPU is busy executing your request. This requires math calculations by
the CPU. Hence, the message.

not seen this before

Your CPU is so fast that by the time the Status Bar could be updated, the
calculation is done, so there's no need for the message. Whatever the
current request is for the CPU to execute, it's taking some time to finish,
so the Status Bar has time to update you and advise you what it's doing,
calculating.

Second problem is that the requery doesn't call the data up correctly

Try:

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "Period = " & intPeriod & " AND [Year] = " & intYear
Me.Filter = varwhere
Me.FilterOn = True

And I would advise against using Reserved words, such as Year, when naming
items. It will result in buggy applications.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.


:

I have a form built on a temporary table which is using Year/Period to
differentiate between records. On accessing the form the current period data
is displayed (uses a varwhere statement containing the year and period values
created in a pop-up form to then call this form).
At the bottom of the form I have 10 command buttons, one for the current
period and one for the 9 preceeding periods. When pressing one of these
buttons the intention is to display the releveant data for that period. The
code inside each button builds the varwhere statement with the selected
period and then issues a Me.Requery. This does not populate the data as I
intended.

First problem I have encountered is that a 'Calculating ....' message is
displayed at the bottom of the Access screen - not seen this before,and
nothing I have invoked in the form should be causing this to happen as far as
I am aware. This appears to stall the screen and I need to move focus out of
the form (to the internet or something else) and then back into the form to
action anything on the screen (scrollbar etc).

Second problem is that the requery doesn't call the data up correctly, just
leaves the data as for the original varwhere entry from the popup. I have
missed something out or I am not applying the correct logic somewhere but
cannot see the wood for the trees so to speak.

Code used in Command button On Click is shown below :-

intYear = GetYear(1)
intPeriod = GetPeriod(1)
varwhere = "ztblA.Period = " & intPeriod & " AND ztblA.Year = " & intYear
Me.Requery
'DoCmd.ApplyFilter , varwhere (tried this as well)

GetPeriod calculates the filtered original value sent to the form minus the
value in quotes. GetYear checks for a change in year (only occurs when near
start of Financial year). Both use simple IF statements only to return values.


Comments, help or info gladly appreciated.

Cheers,
Steve
 

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