Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

930 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

10 Experts available now in Live!

Get 1:1 Help Now