G
Guest
Good morning. Trying to get my feet wet with SQL and Access 2000. Working
on a customer sub database (approx 300K records) that updates daily/monthly
with new records.
Records are imported from one of two files: Signups or Cancellations. The
records themselves are identical in each file (i.e. SKU, signup date, name,
email, address, so on), with the addition of a cancel date in the
Cancellations file.
The two are merged, updated, etc. and a master list results with Current
subs and Cancelled subs. Current subs have a [Cancel Date] of null.
In the query I am building, I want to calculate [Sub Length] based on the
difference between Cancel Date and Create Date. Easy enough when the value
is not null. For a null value, the query should always calculate sub length
using today's date (Date()) - [Create Date].
I pulled an example from another site that looked like this:
Function SubLength(CancelDate As Variant) As Integer
If IsNull(CancelDate) Then
SubLength = Date()-CancelDate
Exit Function
End If
SubLength = DateDiff(?yyyy?, CreateDate, CancelDate)
End Function
I couldn't quite get this to work in expression builder. Sorry for my
ignorance, just getting started with this type of query.
Thanks,
Don
on a customer sub database (approx 300K records) that updates daily/monthly
with new records.
Records are imported from one of two files: Signups or Cancellations. The
records themselves are identical in each file (i.e. SKU, signup date, name,
email, address, so on), with the addition of a cancel date in the
Cancellations file.
The two are merged, updated, etc. and a master list results with Current
subs and Cancelled subs. Current subs have a [Cancel Date] of null.
In the query I am building, I want to calculate [Sub Length] based on the
difference between Cancel Date and Create Date. Easy enough when the value
is not null. For a null value, the query should always calculate sub length
using today's date (Date()) - [Create Date].
I pulled an example from another site that looked like this:
Function SubLength(CancelDate As Variant) As Integer
If IsNull(CancelDate) Then
SubLength = Date()-CancelDate
Exit Function
End If
SubLength = DateDiff(?yyyy?, CreateDate, CancelDate)
End Function
I couldn't quite get this to work in expression builder. Sorry for my
ignorance, just getting started with this type of query.
Thanks,
Don