[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Alternate text if databasefield is empty

Posted on 2014-03-03
4
Medium Priority
?
229 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 54

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 54

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

656 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