My Assistant
![]() ![]() |
|
|
May 6 2012, 10:47 AM
Post
#1
|
|
|
UtterAccess Guru Posts: 724 From: Arcadia, Florida |
Dim TranDate as Date
TranDate = [Forms]![ReceivedForm]![DatePaid] and gives me an Invalid Use of Null error if there is nothing in the field, which is possible so I need to get around it by either bypassing or envoking a message that there is no date Thanks Ed |
|
|
|
May 6 2012, 10:58 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 7,394 From: Oadby Leics, UK |
if isnull([Forms]![ReceivedForm]![DatePaid]) then
msgbox "No date" ' or whatever you want to do here else TranDate = [Forms]![ReceivedForm]![DatePaid] End if |
|
|
|
May 7 2012, 09:33 AM
Post
#3
|
|
|
UtterAccess VIP Posts: 23,583 From: Mississippi |
Or you could not specify a data type. In that case, Access will treat it as a type Variant, which can contain a Null.
Then you would test for the null value, converting it to some impossible value, otherwise using it as a date. For instance, If IsNull(VariableName) Then DateValue = CDate(0) ' or some other impossible vallue Else If IsDate(VariableName) Then DateValue =VariableName End If End If |
|
|
|
May 7 2012, 09:39 AM
Post
#4
|
|
|
UtterAccess Guru Posts: 724 From: Arcadia, Florida |
Thanks all ... as usual it worked perfectly
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 19th May 2013 - 11:46 AM |