mas7357
Posts: 29
|
| Posted: 02/28/2007, 10:28 AM |
|
I want to get round the default behaviour of a report form and display an empty form until selection criteria is supplied. I have used the following code for grids and it works well
if (FormName.command.Where = "") then
FormName.command.Where = "FieldName = impossible_value"
end if
When I use it with a report I get the error message
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
Any Help would be great!!
_________________
MikeS |
 |
 |
Benjamin Krajmalnik
|
| Posted: 03/01/2007, 7:28 AM |
|
Code should be:
if EventCallerwhere = "" then
EventCaller.Where = [yourcondition]
end if
The problem is that the where is part of the datasource object, and you are
trying to bind it to something else.
If you are in the "BeforewhateverSelect" of an object, EventCaller will bind
it to the correct one.
"mas7357" <mas7357@forum.codecharge> wrote in message
news:645e5c9d19049d@news.codecharge.com...
>I want to get round the default behaviour of a report form and display an
>empty
> form until selection criteria is supplied. I have used the following code
> for
> grids and it works well
>
> if (FormName.command.Where = "") then
> FormName.command.Where = "FieldName = impossible_value"
> end if
>
> When I use it with a report I get the error message
>
> ADODB.Recordset error '800a0e78'
>
> Operation is not allowed when the object is closed.
>
> Any Help would be great!!
> _________________
> MikeS
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
MIke Snowden
|
| Posted: 03/01/2007, 11:13 AM |
|
Thanks Benjamin for the rapid response. Being a novice I took your code literally and put it in the beforeexecute elect of the report and I keep on getting an error-there is a problem with your page......so something id not right. I entered:
if EventCallerwhere = "" then
EventCaller.Where = "Name=xxx"
end if
and have tried
if EventCallerwhere = "" then
EventCaller.Where = [Name=xxx]
end if
and even tried
if EventCallerWhere = "" then
EventCaller.Where = ["Name = xxx"]
end if
Can you help once more
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 03/01/2007, 1:54 PM |
|
I am not into ASP syntax, sorry.
But your problem is
if EventCallerwhere = "" then
EventCaller.Where = "Name=xxx"
end if
Should be something like
if EventCallerwhere = "" then
EventCaller.Where = "Name= 'xxx' "
end if
Because you want the SQL to eventually be:
SELECT * FROM table WHERE Name = "xxx"
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
mas7357
Posts: 29
|
| Posted: 03/02/2007, 10:34 AM |
|
I have tried every permuation of the code above in the before execute select function of the report form and nothing happens with Datasource.where or command.where-can anybody help
_________________
MikeS |
 |
 |
Benjamin Krajmalnik
|
| Posted: 03/04/2007, 10:39 AM |
|
Small typo in the first line.
s/b
if EventCaller.Where = "" then
EventCaller.Where = "Name=xxx"
end if
Note the missing period between EventCaller and Where.
It would help if you give more info.
Where ar you trying to get the xxx value from? Is it numeric or text.
There are a few details there which can get you.
<MIkeSnowden@forum.codecharge (MIke Snowden)> wrote in message
news:645e725d535e53@news.codecharge.com...
> Thanks Benjamin for the rapid response. Being a novice I took your code
> literally and put it in the beforeexecute elect of the report and I keep
> on
> getting an error-there is a problem with your page......so something id
> not
> right. I entered:
>
> if EventCallerwhere = "" then
> EventCaller.Where = "Name=xxx"
> end if
>
> and have tried
>
> if EventCallerwhere = "" then
> EventCaller.Where = [Name=xxx]
> end if
> and even tried
>
> if EventCallerWhere = "" then
> EventCaller.Where = ["Name = xxx"]
> end if
>
> Can you help once more
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
mhope
Posts: 37
|
| Posted: 03/07/2007, 2:06 PM |
|
if Cstr(Len(EventCaller.Where)) < 0 then EventCaller.Where = "Name=xxx"
|
 |
 |
mas7357
Posts: 29
|
| Posted: 03/09/2007, 3:43 AM |
|
Thanks both for replying- I am still having problems..... here is some more information.
I have a page with a search form and a report. The report takes data from three qries and a table within an access database. When the page is opened the form is populated with data from the queries/tables. The data extracted are:
Name, Race_Name, Race_Time, District_Standard, Venue and Event_Date and the report groups them by age.
The form has a number of dropdown boxes so that the user can select District standard (Yes/No) Name and Age of particular competitors.
The problem is that I have a few hundred competitoirs now and the page takes time to load- So what I wanted to do is suppress the first load of the report (to show no data on load and then to show the data in response to the user input in the record form. I have tried both your code snippets separately into the before execute select event of the report (or the form!) and I get either a error page (there is something wrong with your page....) or nothing happens
I am sure I am doing something stupid as I have onbly been using Codecharge for a short while but this is very frustrating- especially as the solution for a grid seems so easy
if (qryname.command.Where = "") then
qryname.command.Where = "Current_Age = someting stupid"
end if
Thanks for persevering with me on this- it is much appreciated
Mike
_________________
MikeS |
 |
 |
charles
Posts: 59
|
| Posted: 03/10/2007, 8:47 PM |
|
try this,it always works for me
If Isempty(Request.QueryString("s_period_id")) Then
If Isempty(Request.QueryString("s_salary_group_id")) Then
If Isempty(Request.QueryString("s_work_id")) Then
payroll_queries4.Visible=False
Else
Payroll_queries4.Visible=True
End If
End If
End if
adjust the above to suit your particular case.
Regards,
charles
|
 |
 |
mas7357
Posts: 29
|
| Posted: 03/12/2007, 12:49 PM |
|
Thanks Charles- Where does the code go and will it stop the query being executed and hence improve the performance of the page?
_________________
MikeS |
 |
 |
mhope
Posts: 37
|
| Posted: 03/13/2007, 1:44 PM |
|
I would ajax the page. But, if you don’t want anything to show first up, in the Visual Query Builder change the WHERE in the User Default parameter if query is empty to: -1 then nothing will show if the query is empty.
|
 |
 |