Solved

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

Posted on 2014-12-02
2
154 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 27

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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 …
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…

821 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