Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2003 Syntax for empty text box?

Posted on 2006-07-11
4
Medium Priority
?
440 Views
Last Modified: 2012-08-14
Hi All,
I have to following in a text box in a report in Access 2003:

="Revised Date" & " " & Format([crpProduct_RevisedDate],"mmmm dd"", ""yyyy")

What I want to be able to do though is if this date values is empty don't show the text box on the report other wise if it does contain a date show its value. I was wondering if there is syntax like an if statement i can put in the control source to do this or do I have to set visible and not visible for the text box in the code behind the report?
Which is the best way? I would prefer to do it in the control source but not too sure of the syntax. In the code behind i have something similar done already.
Thanks again in advance for all the help.
0
Comment
Question by:sabrina_spillane
  • 2
4 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17082710
U can use IsNull

if IsNull(crpProduct_RevisedDate)=False then
  xx= ="Revised Date" & " " & Format([crpProduct_RevisedDate],"mmmm dd"", ""yyyy")
else
  msgbox "Isnull"
end if
0
 
LVL 18

Accepted Solution

by:
Data-Man earned 600 total points
ID: 17082716
How about this

= IIF(ISNULL([crpProduct_RevisedDate]),"","Revised Date" & " " & Format([crpProduct_RevisedDate],"mmmm dd"", ""yyyy"))


HTH,
Mike
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 400 total points
ID: 17082723
If u want this in the control source, u can do this

IIF(IsNull(crpProduct_RevisedDate),'',="Revised Date" & " " & Format([crpProduct_RevisedDate],"mmmm dd"", ""yyyy"))
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 17082818
>>>>>What I want to be able to do though is if this date values is empty don't show the text box on the report <<<<

Assuming your text box is located in the Detail section of your report you can use the OnFormat event of the Detail section as follows ...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  If IsNull(Me.crpProduct_RevisedDate) Then
      Me.MyTxtBox.Visible = False
  Else
      Me.MyTxtBox.Visible = True
  End If
End Sub

ET
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

963 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