Conditional Results

M

mccloud

I have an Access database query that feeds a frontpage web site. I have a
text field and a Currency field. My question is there a way to populate a
default value when the field is blank. For example in the text field when
blank display" Call" and in the Currency field dispaly "0".

Thanks in advance for your help!
 
K

Kathleen Anderson [MVP - FrontPage]

You can wrap the DatabaseResultsColumn in some script - here's an example:


<% If fp_rs("Municipality") > " " then %>


<li><b>Municipality:</b> ­<!--webbot bot="DatabaseResultColumn"
startspan


s-columnnames="ProgramArea,Rec­ordNum,Date,ItemNumber,SplitIt­em,Session,PA_SA
,ActNumber,Section,Recipient,M­unicipality,FundsUse,DollarFie­ld1,DollarField2
,DollarField3,DollarField4,Any­_Previous,DollarField5,FundNum­,AgencyNum,SID,P
roject_Num,Description"
s-column="Municipality" b-tableformat="FALSE" b-hashtml="FALSE"
clientside
preview="<font
size="-1">&lt­;&lt;</font>Municipa­lity<font
size="-1">&gt­;&gt;</font>" b-makelink
b-MenuFormat --><%=FP_FieldVal(fp_rs,"Munic­ipality")%><!--webbot
bot="DatabaseResultColumn" endspan i-checksum="33247" --></li>


<% End If %>


You can also check the value of one field to determine whether to show
another.
 
P

Paul M

Hi
You can open the database table in access click on the veiw button (top
left)and set the default to 0 for number fields or text for text fields if
you use text put the text in quotes "Call". then when the database is
being populated if nothing is entered into the field it will display the
default
Paul M
 
K

Kathleen Anderson [MVP - FrontPage]

I believe he is asking how to populate the field on a query results page,
not populate the database field during an update.
 
T

Thomas A. Rowe

However Paul M, solution would also solve the problem, as the fields would never be empty, therefore
no test (IF statement) would be need to determine if the field is empty

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
S

Stefan B Rusynko

I would agree setting a known default is a better option because it doesn't require any testing

The test that was posted checks for a space (> " ") as a Boolean result
<% If fp_rs("Municipality") > " " then %>
That is a Boolean comparison for > " "
- not a zero-length string ("") test,
Which will fail (evaluate to False) if there is a character = " " in the field, or any other character in the field evaluating to or
less than a space

Probably better to check for a string length (rather than a space or zero-length string)
<% If Len(fp_rs("Municipality"))> 0 then %>

And that also doesn't check for a Null field as opposed to an empty string or zero-length string
At best it should also check for any Null as say:
<% If ( Not IsNull(fp_rs("Municipality")) ) OR ( Len(fp_rs("Municipality"))> 0 ) Then %>



| However Paul M, solution would also solve the problem, as the fields would never be empty, therefore
| no test (IF statement) would be need to determine if the field is empty
|
| --
| ==============================================
| Thomas A. Rowe (Microsoft MVP - FrontPage)
| ==============================================
| If you feel your current issue is a results of installing
| a Service Pack or security update, please contact
| Microsoft Product Support Services:
| http://support.microsoft.com
| If the problem can be shown to have been caused by a
| security update, then there is usually no charge for the call.
| ==============================================
|
| | >I believe he is asking how to populate the field on a query results page, not populate the database
| >field during an update.
| >
| > --
| > ~ Kathleen Anderson
| > Microsoft MVP - FrontPage
| > Spider Web Woman Designs
| > web: http://www.spiderwebwoman.com/resources/
| >
| >
| >> Hi
| >> You can open the database table in access click on the veiw button (top left)and set the
| >> default to 0 for number fields or text for text fields if you use text put the text in quotes
| >> "Call". then when the database is being populated if nothing is entered into the field it will
| >> display the default
| >> Paul M
| >> | >>>I have an Access database query that feeds a frontpage web site. I have a
| >>> text field and a Currency field. My question is there a way to populate a
| >>> default value when the field is blank. For example in the text field when
| >>> blank display" Call" and in the Currency field dispaly "0".
| >>>
| >>> Thanks in advance for your help!
| >>
| >>
| >
| >
|
|
 
M

mccloud

I am trying to populate a field on a results page. However the query is
linked to a SQL table that I can't change. I was able to get the number
field to work by using "Compatible Price: IIf([cap-Price]="
","NA",([cap-Price]))" but the text field must be defined differntly because
this doesn't work "Compatible: IIf([dbo_imitmidx_sql].[user_def_fld_3]="
","Coming Soon",([dbo_imitmidx_sql].[user_def_fld_3]))"
Any ideas?
 
T

Thomas A. Rowe

Question: If one field is empty, does this mean the other field is also empty? If this is always so,
then this can be solve easily with a single IF statement at the point of display.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================

mccloud said:
I am trying to populate a field on a results page. However the query is
linked to a SQL table that I can't change. I was able to get the number
field to work by using "Compatible Price: IIf([cap-Price]="
","NA",([cap-Price]))" but the text field must be defined differntly because
this doesn't work "Compatible: IIf([dbo_imitmidx_sql].[user_def_fld_3]="
","Coming Soon",([dbo_imitmidx_sql].[user_def_fld_3]))"
Any ideas?

Thomas A. Rowe said:
However Paul M, solution would also solve the problem, as the fields would never be empty,
therefore
no test (IF statement) would be need to determine if the field is empty

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
M

mccloud

No they are seperate conditions.

Thomas A. Rowe said:
Question: If one field is empty, does this mean the other field is also empty? If this is always so,
then this can be solve easily with a single IF statement at the point of display.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================

mccloud said:
I am trying to populate a field on a results page. However the query is
linked to a SQL table that I can't change. I was able to get the number
field to work by using "Compatible Price: IIf([cap-Price]="
","NA",([cap-Price]))" but the text field must be defined differntly because
this doesn't work "Compatible: IIf([dbo_imitmidx_sql].[user_def_fld_3]="
","Coming Soon",([dbo_imitmidx_sql].[user_def_fld_3]))"
Any ideas?

Thomas A. Rowe said:
However Paul M, solution would also solve the problem, as the fields would never be empty,
therefore
no test (IF statement) would be need to determine if the field is empty

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================

I believe he is asking how to populate the field on a query results page, not populate the
database
field during an update.

--
~ Kathleen Anderson
Microsoft MVP - FrontPage
Spider Web Woman Designs
web: http://www.spiderwebwoman.com/resources/


Hi
You can open the database table in access click on the veiw button (top left)and set the
default to 0 for number fields or text for text fields if you use text put the text in quotes
"Call". then when the database is being populated if nothing is entered into the field it will
display the default
Paul M
I have an Access database query that feeds a frontpage web site. I have a
text field and a Currency field. My question is there a way to populate a
default value when the field is blank. For example in the text field when
blank display" Call" and in the Currency field dispaly "0".

Thanks in advance for your help!
 
S

Stefan B Rusynko

You probably need to test for Null fields, not just zero-length string ("") tests or empty string tests
- and you shouldn't need Conditional IIF statements for a results page displaying record field values of a recordset (a std IF Then
Else should work for each record)




|I am trying to populate a field on a results page. However the query is
| linked to a SQL table that I can't change. I was able to get the number
| field to work by using "Compatible Price: IIf([cap-Price]="
| ","NA",([cap-Price]))" but the text field must be defined differntly because
| this doesn't work "Compatible: IIf([dbo_imitmidx_sql].[user_def_fld_3]="
| ","Coming Soon",([dbo_imitmidx_sql].[user_def_fld_3]))"
| Any ideas?
|
| "Thomas A. Rowe" wrote:
|
| > However Paul M, solution would also solve the problem, as the fields would never be empty, therefore
| > no test (IF statement) would be need to determine if the field is empty
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | > >I believe he is asking how to populate the field on a query results page, not populate the database
| > >field during an update.
| > >
| > > --
| > > ~ Kathleen Anderson
| > > Microsoft MVP - FrontPage
| > > Spider Web Woman Designs
| > > web: http://www.spiderwebwoman.com/resources/
| > >
| > >
| > >> Hi
| > >> You can open the database table in access click on the veiw button (top left)and set the
| > >> default to 0 for number fields or text for text fields if you use text put the text in quotes
| > >> "Call". then when the database is being populated if nothing is entered into the field it will
| > >> display the default
| > >> Paul M
| > >> | > >>>I have an Access database query that feeds a frontpage web site. I have a
| > >>> text field and a Currency field. My question is there a way to populate a
| > >>> default value when the field is blank. For example in the text field when
| > >>> blank display" Call" and in the Currency field dispaly "0".
| > >>>
| > >>> Thanks in advance for your help!
| > >>
| > >>
| > >
| > >
| >
| >
| >
 

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