hmm, i thought you might get that error if any record did not have a value
entered in the birthday field, but i wasn't able to duplicate the error.
nevertheless, try this, just in case
BdayMonth: Choose(CInt(Nz(Left([Member
Information]![Bday],2),0)),"January","February","March","April","May","June"
,"July","August","September","October","November","December")
if above doesn't work, suggest you post the SQL from the query, so we can
look at it. also, i'm wondering a couple things: is your query multi-table?
and if so, do you have a field named Bday in more than one of the query
tables? if not, why include the table name in the calculated field? and how
are your users opening the report? from the database window? or from a form?
if from a form, can you add an unbound combo box listing the months of the
year, to the form, and use that as the query criteria? that way your users
don't have to type in the entire month name, or worry about spelling, and we
could make the calculated field in the query much, much simpler, too.
btw, suggest you don't use "Month" as the name of your calculated field
because that is an Access Reserved Word, and may cause problems. that's why
i used a prefix with "Month" in my previous post and in this one.
hth
Dumb Blonde said:
Tina - great suggestion! I placed the following in the field name for the
query underlying my birthday report.
Month: Choose(CInt(Left([Member
Information]![Bday],2)),"January","February","March","April","May","June","J
uly","August","September","October","November","December")
It worked like a charm but...... I've got [Enter Month] in the Criteria
field so that I can select which birthdays I want to include. I get a return
message that says "Invalid Use of Null". Any suggestions?
:
PMFJI...
i agree with Rick about adding an additional field to the table with a
"month" value - redundant data; and the additional problem you ran into -
how to enter a value in that field when a record is added (or the birthday
value is changed in an existing record). if you do want to change your
birthday field to a date/time data type, then Rick, LeAnne and the
MVPs
will
come up with a solution for you, i'm certain.
if you want to stick with the birthday field as mmdd text, then how about
adding a calculated control to the query that underlies the monthly report,
as
BdayMonth:
Choose(CInt(Left([BirthdayFieldName],2)),"January","February","March",<conti
nuing on to>,"December")
then set the criteria on this calculated field.
hth
Is there an easy way to convert the existing text fields to a date field
without losing data. The data was maintained in Excel previously
and
so
when
it was converted to Access, it was converted as text.
:
You are duplicating data here. You have a field with month and date,
and
another field with month. Why not just have two fields? One with
month,
and one with date? Or better, use a real date field?
Using date fields allows yo uto utilize built-in functions to
pull
out
the
month or the date and allows "between" logic to be used.
Rick B
I maintain a database for a non-profit and am self-taught.
One of
the
monthly reports is titled Birthdays. The birthday field is a text
field
(mmdd). Previously, the user would enter the beginning and ending
mmdd to
include (so 0101 and 0131). They've now asked that they just
be
able
to
enter the month name rather than the range of dates.
I've performed an update query to add a field titled bday
month
and
converts
the dates to month name. The query and report work fine when
the
user
types
in the month name.
The Question: how do I automatically update the bday month
field
each
time
a
new record is entered with only the birthdate?
And, since I'm self-taught, I don't know VB.
Any help would be appreciated. Thanks!