Code error!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a list box that contains two columns: the first contains values 1 - 6, the second contains days of the week, Sunday - Friday. The first column is the bound column. When I click a day in the list box, a second form opens up as a datasheet with only customers assigned to that day. When this second form opens, I want a caption to read - Me.caption = "Call day - "&[Day]. I coded this in the On open property for the second form. It works like a gem unless there are no days in the query for the selected day. How do I write the code to handle no days and to return a caption of "There are no customers on this day"

Any help would be appreciated

Don Rountree
 
See if this will work.

Me.Caption = IIf(IsNull([Day], "There are no customers on this day", "Call
day - " & [Day])
or
Me.Caption = IIf(Me.RecordSet.RecordCount = 0, "There are no customers on
this day", "Call day - " & [Day])

--
Wayne Morgan
Microsoft Access MVP


Don Rountree said:
I have a form with a list box that contains two columns: the first
contains values 1 - 6, the second contains days of the week, Sunday -
Friday. The first column is the bound column. When I click a day in the
list box, a second form opens up as a datasheet with only customers assigned
to that day. When this second form opens, I want a caption to read -
Me.caption = "Call day - "&[Day]. I coded this in the On open property for
the second form. It works like a gem unless there are no days in the query
for the selected day. How do I write the code to handle no days and to
return a caption of "There are no customers on this day".
 
Back
Top