Solved

A calculated field in Access returns time - But if the calculated field is blank it returns error

Posted on 2014-12-02
2
150 Views
Last Modified: 2015-01-15
Hi Experts

I think this might be an easy question for Access Experts :-)

I have a calculated field that has to return the starttime for bowling Lanes. But in the same file, I have the transactions, related to other form of sales (where there is no starting time.

If there is a starting time, below function Works great. [Placement] is a textfield containing other information as well.

Starttime: TimeSerial(Left([Placement];2);Mid([placement];3;2);"00")

If there is no starttime, I want my Query to return a blank cell.

regards

Jørgen
0
Comment
Question by:Jorgen
2 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 300 total points
ID: 40477888
If when there is no start time Placement is blank, the following will work:
Starttime: IIF(Len(Placement)=0,"",(TimeSerial(Left([Placement];2);Mid([placement];3;2);"00"))

Open in new window

If it will contain other information, I'll have to see a sample of what it can contain.
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 200 total points
ID: 40478046
A blank cell is Null, thus:

Starttime: IIf(IsDate(Left([Placement];2) & ":" & Mid([Placement];3;2));TimeSerial(Left([Placement];2);Mid([Placement];3;2);0);Null)

/gustav
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now