Database fields with no data

Results 1 to 3 of 3

Thread: Database fields with no data

  1. #1
    Join Date
    Dec 1969

    Default Database fields with no data

    I am in the process of building a database showing three different types of statistics by local areas, where each statistical type is stored in a separate database table. However, data are not available for all of the local areas which results in some empty fields. <BR><BR>I have created two ASP pages; page one contains a form where the user is asked to select a local area from a drop down list. He is then taken to page 2 which shows three tables. Each table contains VB script which interrogates the relevant table in the database - using runtime SQL statements - to return the desired statistics. <BR><BR>However, if the user were to select a local area where data is missing for some of the years in table 1 but where data is available for the other years in table 1, tables 2 and 3, he would receive an ugly message. <BR><BR>In this instance, I would like to be able to show that no data is available for some of the years in table 1 but then show the data that is available in tables 1, 2 and 3. <BR><BR>I should say that the cells returning statistics in each of the tables have been formatted using either FormatNumber or FormatPercent. I think this is part of my problem but would really appreciate your thoughts on this.<BR><BR>Alison<BR><BR>

  2. #2
    Eddie Campbell Guest

    Default RE: Database fields with no data

    Can&#039;t you just test for Table1.Eof and if it is true display a message saying that there is no data currently available and then move on to the next year.<BR>e.g.<BR><BR>If Table1.Eof then<BR> Response.Write "&#060;tr&#062;&#060;td&#062;Data Not Available&#060;/td&#062;&#060;/tr&#062;"<BR>Else<BR> Response.Write "&#060;tr&#062;&#060;td&#062;" & FormatPercent(MyValue)&#060;/td&#062;&#060;/tr&#062;"<BR>End If<BR>etc.

  3. #3
    Join Date
    Dec 1969

    Default Use IsNull()

    If there are literally empty fields in Table1 for a given local area then you can use an If statement such as:<BR><BR>If Not IsNull(RECORDSET FIELD NAME) Then<BR> Whatever code you need<BR>End If<BR><BR>However if there are simply no fields associated with the local area you would have to use the EOF property as previously suggested

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts