Hello all,
I have a field in a query(make table) which calculates the number of days between 2 dates[TIME], then I have the query determine the value of two other fields 'Letter: LetType([TIME])' and 'range: PeriodChecker([TIME])' depending on the value of [TIME]. I do this by using a function like this;
Public Function LetType(intDays As Integer) As String
Select Case intDays
Case Is <= 180
LetType = "Less than 6 Months"
Case Is <= 210
LetType = "6M"
Case Is <= 870
LetType = "2Y"
Case Is <= 900
LetType = "30M"
Case Else
LetType = "not required"
End Select
End Function
I usually get a variety of results for the LetType Field, but I'm really only interested in the records where LetType is 6M or 30M. I use these records in a Word Mail Merge. I tried altering the query by putting 6M or 30M in the crieria box for LetType, but I then get a prompt to enter parameter value for the TIME field. I'm thinking something about circular reference..but I ain't sure at all!
Is there any way to have the query only return records where LetType is 6M or 30M? The reason I want to do this is simple; if there are no records where LetType is 6M or 30M then I'll stop the mail merge before it begins and have Access tell the user 'No data to report' - if there are better ways to do this I would glad to hear, although I'm a bit pushed for time and would rather stick with what I've done already.
Many thanks for any help,
FrankyG
I have a field in a query(make table) which calculates the number of days between 2 dates[TIME], then I have the query determine the value of two other fields 'Letter: LetType([TIME])' and 'range: PeriodChecker([TIME])' depending on the value of [TIME]. I do this by using a function like this;
Public Function LetType(intDays As Integer) As String
Select Case intDays
Case Is <= 180
LetType = "Less than 6 Months"
Case Is <= 210
LetType = "6M"
Case Is <= 870
LetType = "2Y"
Case Is <= 900
LetType = "30M"
Case Else
LetType = "not required"
End Select
End Function
I usually get a variety of results for the LetType Field, but I'm really only interested in the records where LetType is 6M or 30M. I use these records in a Word Mail Merge. I tried altering the query by putting 6M or 30M in the crieria box for LetType, but I then get a prompt to enter parameter value for the TIME field. I'm thinking something about circular reference..but I ain't sure at all!
Is there any way to have the query only return records where LetType is 6M or 30M? The reason I want to do this is simple; if there are no records where LetType is 6M or 30M then I'll stop the mail merge before it begins and have Access tell the user 'No data to report' - if there are better ways to do this I would glad to hear, although I'm a bit pushed for time and would rather stick with what I've done already.
Many thanks for any help,
FrankyG