![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
=#1/1/2000# |
|
=#1/1/2000# (any date 1/1/2000 and later) |
|
At the hospital I have a database with 200 records in it for volunteers and one of the columns has dates set up like this "Oct. 03". The column is in text format. Those dates change as people take the required test that the column of the record is for. It can be empty or have older dates in it and it can also have Empl in it. When I run a query on that column I use "Is Null, Or like "*00", Or like "*01", Or Like "*02"". This gives me everyone who has not taken the test in 03, but it also picks up the ones marked as Empl. Is there something I can use in there so it won't pick up the records marked as Empl? Also is there something I can use to get all dates in 03 older than Oct. 03. I have tried different things, but get all 200 records in the report. I have tried the help files, but don't understand how to do it as I'm self taught and have never taken lessons on this. Thanks for any help. Rocky |
#3
| |||
| |||
|
|
Rocky, The data in the field is text data, also known as string data. Access can only sort it alphabetically. So, if you ask for fields containing dates earlier than x or dates in the second half of 2002 (for example), it won't give you what you want. If the table field contained data of a date/time data type, you could specify such criteria easily and reliably on dates or parts of dates (by year, by month, whatever) I am sure that you don't want to rebuild the table with a date/time datatype, especially with some records containing "Empl". But I have a solution for you. Depending on your database skills, you might want to do it yourself or have someone build this. It's not a very time-consuming project if you know your way around Access. (I do consulting work if needed!) Build a table which contains a date-time conversion for each of the allowed entries in the field that you're testing on. It has only two fields - one with the text string, and one containing an actual date. (You set the field's data type in Table Design when building the table, or after building it) Like this: TEXT - Date/Time data Empl - 1/1/1800 (see note below) Jan. 00 - 1/1/2000 Feb. 00 - 2/1/2000 Mar. 00 - 3/1/2000 Apr. 00 - 4/1/2000 (etc.) I showed a date that would otherwise be unused for "Empl", just so there would be something there. Make the Text field the key field, and link that table to your main table on that field. You can thoroughly leave the original table's text field as-is. For instance, if it contains "Apr 02" and "Apr. 02" and "Apr 2002" you just make extra entries in your new table for each of those, and give them all a date value of 4/1/2002. When you pull in your date data in the query, those records will all read as 4/1/2002. Now you add the new table to your query, and do all your specifying of date information against the date/time field in the new linked table. You can specify dates before or after some date as greater than or less than (use > or <, or use >= or use <= ) or you can specify "Between" two dates, etc. Examples: Between #1/1/2000# And #4/1/2002# =#1/1/2000# You can put a criteria in a second row, below the one where you specify a date range, in the original text field, to allow in records marked "Empl" in the original primary table's field. This gets you out of constantly having to specify to accept a date of 1/1/1800, or whatever date you use for that text value. When you specify dates in an Access query's criteria, it wants # symbols before and after, and no leading zeroes in the day and month positions. That is the format you need. The query design view will usually fix up your entry for you if you use the query-building grid. Examples: Between #1/1/2000# And #4/1/2002# =#1/1/2000# (any date 1/1/2000 and later) Bruce Bruce Pick Tech Services "Rocky" <rockfish (AT) home (DOT) ca> wrote in message news:ui8900tbqmd9fojcam02ci9svjlokbs34p (AT) 4ax (DOT) com... At the hospital I have a database with 200 records in it for volunteers and one of the columns has dates set up like this "Oct. 03". The column is in text format. Those dates change as people take the required test that the column of the record is for. It can be empty or have older dates in it and it can also have Empl in it. When I run a query on that column I use "Is Null, Or like "*00", Or like "*01", Or Like "*02"". This gives me everyone who has not taken the test in 03, but it also picks up the ones marked as Empl. Is there something I can use in there so it won't pick up the records marked as Empl? Also is there something I can use to get all dates in 03 older than Oct. 03. I have tried different things, but get all 200 records in the report. I have tried the help files, but don't understand how to do it as I'm self taught and have never taken lessons on this. Thanks for any help. Rocky |
#4
| |||
| |||
|
|
=#1/1/2000# You can also specify Is Null (or) Is Not Null |
|
Bruce I understand what your saying, but I don't know how to do it. I built this database myself about 4 years ago. I only have two records that have Empl in them and one NA. In 75% of the others is the date of Oct. 03. It would not be to much work to make those fields Date/Time format and change the dates to 1/1/1800 for Empl and 1/1/1801 or NA because we don't search for them. I can make all the other dates 10/1/2003 and what ever the other few are other then Oct. 03 with copy and paste. This is what you mean by rebuilding the database, correct? When I said column in the first question I meaning field and the 200 records are listed in a column, but I guess you understood that. Rocky On Wed, 14 Jan 2004 15:20:27 -0500, "Bruce Pick" brucepick1 (AT) comcast (DOT) net> wrote: Rocky, The data in the field is text data, also known as string data. Access can only sort it alphabetically. So, if you ask for fields containing dates earlier than x or dates in the second half of 2002 (for example), it won't give you what you want. If the table field contained data of a date/time data type, you could specify such criteria easily and reliably on dates or parts of dates (by year, by month, whatever) I am sure that you don't want to rebuild the table with a date/time datatype, especially with some records containing "Empl". But I have a solution for you. Depending on your database skills, you might want to do it yourself or have someone build this. It's not a very time-consuming project if you know your way around Access. (I do consulting work if needed!) Build a table which contains a date-time conversion for each of the allowed entries in the field that you're testing on. It has only two fields - one with the text string, and one containing an actual date. (You set the field's data type in Table Design when building the table, or after building it) Like this: TEXT - Date/Time data Empl - 1/1/1800 (see note below) Jan. 00 - 1/1/2000 Feb. 00 - 2/1/2000 Mar. 00 - 3/1/2000 Apr. 00 - 4/1/2000 (etc.) I showed a date that would otherwise be unused for "Empl", just so there would be something there. Make the Text field the key field, and link that table to your main table on that field. You can thoroughly leave the original table's text field as-is. For instance, if it contains "Apr 02" and "Apr. 02" and "Apr 2002" you just make extra entries in your new table for each of those, and give them all a date value of 4/1/2002. When you pull in your date data in the query, those records will all read as 4/1/2002. Now you add the new table to your query, and do all your specifying of date information against the date/time field in the new linked table. You can specify dates before or after some date as greater than or less than (use > or <, or use >= or use <= ) or you can specify "Between" two dates, etc. Examples: Between #1/1/2000# And #4/1/2002# =#1/1/2000# You can put a criteria in a second row, below the one where you specify a date range, in the original text field, to allow in records marked "Empl" in the original primary table's field. This gets you out of constantly having to specify to accept a date of 1/1/1800, or whatever date you use for that text value. When you specify dates in an Access query's criteria, it wants # symbols before and after, and no leading zeroes in the day and month positions. That is the format you need. The query design view will usually fix up your entry for you if you use the query-building grid. Examples: Between #1/1/2000# And #4/1/2002# =#1/1/2000# (any date 1/1/2000 and later) Bruce Bruce Pick Tech Services "Rocky" <rockfish (AT) home (DOT) ca> wrote in message news:ui8900tbqmd9fojcam02ci9svjlokbs34p (AT) 4ax (DOT) com... At the hospital I have a database with 200 records in it for volunteers and one of the columns has dates set up like this "Oct. 03". The column is in text format. Those dates change as people take the required test that the column of the record is for. It can be empty or have older dates in it and it can also have Empl in it. When I run a query on that column I use "Is Null, Or like "*00", Or like "*01", Or Like "*02"". This gives me everyone who has not taken the test in 03, but it also picks up the ones marked as Empl. Is there something I can use in there so it won't pick up the records marked as Empl? Also is there something I can use to get all dates in 03 older than Oct. 03. I have tried different things, but get all 200 records in the report. I have tried the help files, but don't understand how to do it as I'm self taught and have never taken lessons on this. Thanks for any help. Rocky |
![]() |
| Thread Tools | |
| Display Modes | |
| |