?
Solved

Alternate text if databasefield is empty

Posted on 2014-03-03
4
Medium Priority
?
228 Views
Last Modified: 2014-03-03
If databasefield "soll_uitgenodigd" AND databasefield "soll_afgewezen" are both empty, I like to response write an alternate text. Below code only the "ja" and "nee" code is working:

          <% If  (rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value) = "ja" Then %>
          <span class="toptabGROEN">JA</span>
		  <% End If %>
          <% If  (rsSolliOverzicht.Fields.Item("soll_afgewezen").Value) = "ja" Then %>
          <span class="toptabROOD">NEE </span>
          <% End If %>
          <% If (rsSolliOverzicht.Fields.Item("soll_afgewezen").Value) = "" AND (rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value)= "" Then %>
          <span>geen reactie</span>
		  <% End If %> 

Open in new window


Anyone?
0
Comment
Question by:hanskoens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39900112
if you refer to "empty", it is probably rather "null" than that string value...
anyhow, you may want to do like this (or some other method, for example keeping a boolean value within the if or else stuff ...
          <% If  (rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value) = "ja" Then %>
          <span class="toptabGROEN">JA</span>
		  <% End If %>
          <% If  (rsSolliOverzicht.Fields.Item("soll_afgewezen").Value) = "ja" Then %>
          <span class="toptabROOD">NEE </span>
          <% End If %>
          <% If (rsSolliOverzicht.Fields.Item("soll_afgewezen").Value) <> "ja" AND (rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value) <> "ja" Then %>
          <span>geen reactie</span>
		  <% End If %>  

Open in new window

0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 1000 total points
ID: 39900116
<%
dim soll_afgewezen, soll_uitgenodigd
soll_afgewezen=""
soll_uitgenodigd=""
if not isnull(rsSolliOverzicht.Fields.Item("soll_afgewezen").Value) Then
	soll_afgewezen=rsSolliOverzicht.Fields.Item("soll_afgewezen").Value
end if
if not isnull(rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value) Then
	soll_uitgenodigd=rsSolliOverzicht.Fields.Item("soll_uitgenodigd").Value
end if
if soll_uitgenodigd="ja" Then
	response.write "<span class=""toptabGROEN"">JA</span>"
end if
if soll_afgewezen="ja" Then
	response.write "<span class=""toptabROOD"">JA</span>"
end if
if soll_afgewezen="" and soll_uitgenodigd="" Then
	response.write "<span>geen reactie</span>"
end if

%>

Open in new window


But what happens if soll_afgewezen="ja" and soll_uitgenodigd=""? or the other way around.
0
 
LVL 2

Author Comment

by:hanskoens
ID: 39900123
@ Guy Hengel [angelIII / a3]: sorry but the same results I had before.
@ Scott Fell (padas): Thank you man, this works for me (except you used 2x "ja" instead of "ja" and "nee", but that was just a typo :)
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39900130
I also have a hard time in my own language let alone another...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question