query date from 3 columns

  • Thread starter Thread starter Lisa
  • Start date Start date
L

Lisa

Hi,

I am new to Access and working with a database I did not create. In the
database there are 3 separate columns for the date- Day, Mon, and Yr. I
would like to be able to include in my query a field that combines these
three columns into the date format that I want (e.g. 18-Apr-2007).

I can't figure out where this falls in terms of queries, as I am not
calculating anything- I just want them to show up together in one column in
the query, in that format.

So ultimately I use the query to generate labels in a program called
Bartender. I tried just including each column separately in the query, but
when I pulled the info into Bartender my day and years had decimals (2007.0).
Couldn't figure out what was up, since in my Access columns they look
normal. I didn't know if this is a Bartender or an Access problem, or how to
tell.

I suspect that the guy who created the database used some code to accomplish
this.

Can anyone help??
Thanks!
Lisa
 
SELECT Format(CDate([day] & "-" & [Mon] & "-" & [Yr]),"dd-mmm-yyyy") AS TheDate
FROM tblDatesText
WHERE (((tblDatesText.Day) Between 1 And 31));

Something like the above with the proper table and field names will create
an actual date. The WHERE clause is just a rough way to avoid null values or
bad days which would cause a problem. If you have bad data, such as nulls, 32
days in a year, or misspellings like JUNNE, there will be problems.

If you don't mine seeing a simpler date format, the following will work.

SELECT CDate([day] & "-" & [Mon] & "-" & [Yr]) AS TheDate
FROM tblDatesText
WHERE tblDatesText.Day Between 1 And 31;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top