I have an Access 2007 database that requires a query be run every week to gather every record that was worked on the prior week. The current setup is:
I have a query where the date range's WHERE criteria is: Between [Forms]![frm_Menu]![txt_fromdate] And [Forms]![frm_Menu]![txt_todate]+"1"
"fromdate" and "todate" text boxes in frm_Menu are unbound text boxes. "fromdate" has an AfterUpdate event that fills in "todate" with the date chosen in "fromdate" plus 6 days.
frm_Menu has a button for running the query after "fromdate" and "todate" are filled in.
The issue is, when I run the query for a week's worth of records, I get entries outside the selected date range. For example, if I have "3/1/2015" in the "fromdate" text box and "3/7/2015" in the "todate" text box, I'll receive the results from 3/1 to 3/7, but I'm also getting results from 3/10, 3/11, and 3/12.
At first, I thought it might be reading "3/1/2015" as "3/1x/2015," but that doesn't explain why I'm ONLY getting extra results from 3/10 through 3/12 and not 3/13 through 3/19 as well.
Does anyone know what might be causing this? To work around this problem, I've just been running a query that gathers EVERYTHING and then filtering out what's need in Excel before sending it over. Ideally, I'd like for the person who needs this report to be able to open the database themselves, pick the date range they need, and then export the query results from Access.
It turned out I had the data type for the Dates column as Text instead of Date/Time. Retried the same query after changing the column to Date/Time and it worked perfectly. Just a PEBKAC error.
Related
I am extracting information on medication requests. For each medication request, say in the last 90 minutes, I also want to display a date for any previous time a drug was dispensed for the same patient. In many cases there will be no such history as its the first time the patient has had this drug.
I cannot seem to both show the most recent dates for those patient/drug combinations where there is a prior date but keep the records where there is no history of a prior drug being dispensed.
I have utilised Report, Selection Formulas Group as has worked in the past with different queries.
{#DispenseDT}=MAXIMUM({#DispenseDT},{#RefDRUGPATID})
NB DispenseDT is a formula joining Dispensed Date and Dispensed Time
NB RefDRUGPATID creates a unique reference for each Drug and Patient combination.
This appears to work in pulling through the most recent dispensed date/time for each DRUG/PATIENT combination. If I don't do this I get the first (oldest) record.
However, when I apply this I also lose records. I think this is because not all the DRUG/PATIENT combinations being requested have had previous records so when the formula cant find a MAXIMUM it excludes the record entirely.
I have tried doing something like if isnull({#DispenseDT}then " " else
ToText({#DispenseDT}=MAXIMUM({#DispenseDT},{#RefDRUGPATID})) but when I try and create a formula and display this I just seem to get either BLANKS or TRUE or FALSE displayed, not the "MAXIMUM" DispenseDT. It doesn't like me putting the formula within SELECTION FORMULAS GROUP either.
So in summary I am looking to pull the most recent historical dispensing date for a patient/drug combination for each new request made. But where there is no history of a drug being dispensed I still need to see the new dispensing request record.
I am using crystal reports 13.
Gif of problem
I am currently working on a dashboard in tableau, which shows the count of New-User-Signups and Interactions side-by-side given different date windows. The first New-User-Signup happened before the first Interaction, and the last Interaction happened after the last User Signup.
In order to choose a date window, I linked the date fields in both data sources, and made a date filter, which I applied to all worksheets using related data sources.
However, depending on which "date" field I choose, (from the User Signup table or the Interaction table), the "All Dates" option of the date filter only goes from start to end of that data source's date range.
No matter what I try, I exclude some entries in either one graph or the other. How can I make the "All Dates" filter go from the minimum first date between both data sources, to the maximum last date between the two data sources?
I run into this issue a lot with the data that I use. The problem is that the filter will only be able to contain dates that are in the dataset it is created off of, even if you link the data sources. When I run into this issue, I use parameters instead.
You can find instructions here:
https://kb.tableau.com/articles/howto/creating-a-filter-for-start-and-end-dates-parameters
I have a list on Sharepoint 2013. I've often use the Edit this list link to make bulk changes to the list in datasheet view with no problem. Last week I had a bunch of new records I needed to add so decided bulk copy and paste from Excel would be best. However, I get the error "Invalid date/time value. A date/time field contains invalid data. Please check the value and try again." The field is Date/Time with Date only display. The format I copied in was mm/dd/yyyy, which is how it's displayed (I realize there's a difference between formatting and display). In the past I've used this format to update dates with no problem. I've tried manually changing the date to other formats like yyyy/mm/dd (or with dashes -), and using the date picker and nothing works. I can add a new item using the form and no problem with the date. It's only happening in datasheet view.
I have 70+ records to add and would rather not have to open a new form for each one (I'm only adding info to 7 of the fields, and I first only pasted a couple records to make sure there were no issues). Are there any recent known issues about date fields in datasheet view? It's a pretty straightforward thing, no calculations are being used, I'm not trying to connect to another service, or use outlying dates (dates are all 2017) so I'm perplexed why this is an issue now and not before. Any thoughts on this would be appreciated.
Found the issue. I had another date field I was not using in that view that for some reason the default value had been set to Calculated field with a value of 1/1/1111. No idea how that got there but I removed that and set the default value to None and now the problem is gone. I found it by creating a new view with every date field in the list and systematically copying a date into each field (in bulk edit) and trying to save after each one until it saved. Then I checked the settings for the field that I was able to save with.
I have a query from another thread which goes through a list of different events and pulls out the most recent event and puts it into a list. The code I'm using is:
SELECT Cleaning1, Max(Date1) AS most_recent
FROM CleaningLog
GROUP BY Cleaning1;
Cleaning1 is the column that has the different cleanings, and Date1 is the column that has the date the cleaning occurred, and CleaningLog is the name of the table. I currently have a macro in Access which is an OpenQuery, query. I am having it open the above query, and then having it view as a data sheet and it's in edit mode.
What I am stuck on, is getting a subsequent macro/query/vba code to take the datasheet the query produces and going through each item and determining if they're over due to be cleaned. I tried having a Make Table query, but the problem is, there is no user friendly way to refresh that table without having to delete it (I am having unskilled workers use this Access sheet).
I am wondering if there's a way to look at the most recent cleaning's date, what the query produces, and filter the dates out that are over due for a cleaning, specified by a parameter. I have been looking at this webpage to start playing with the notation, but I haven't been able to come up with much that is useful.
https://support.office.com/en-us/article/Examples-of-query-criteria-3197228C-8684-4552-AC03-ABA746FB29D8
Another problem that I am encountering is that each cleaning doesn't have the same time frame in which is needs to be cleaned.
Thank you in advance for any help!!
You should just be able to modify the query above to show entries with a max date lower than they should be. Below shows entries that haven't been cleaned in 30 days, for instance.
SELECT Cleaning1, Max(Date1) AS most_recent
FROM CleaningLog
GROUP BY Cleaning1
HAVING Max(Date1) < Now() - 30;
Im trying to create a Find Script on two date selection fields (Drop Down calendars) that automatically run each time the field is updated/changed (I understand this part aka script triggers) and the report will show the results that contain dates listed between the range selected.
Please Keep in mind that I'm quite new to this so please correct me where you think I could improve is you find or see anything else that appears to be wrong. Anyways, here is the Layout for my report where the selection fields and results field are highlighted.
Here is the script code I've created and I'm trying to use.
"Pre Construction::Bid Date" ≥ "Bid Date Search::Start Date" & "Pre Construction::Bid Date" ≤ "Bid Date Search::Start Date"
Here is the error I get when I try to add/save this in/under the perform find -> specify dialog box.
Ive tried and set all the fields to use the exact same date layout and format (the xx/xx/xxxx) and ive still had no luck in created this type of search. Im hoping someone will be able to help me fix this or offer other solutions as to how I could go about creating this. Thank you all
There are two problems with your attempt:
First, you cannot use references to fields in a find request.
Next, to find records within a specified range, you must use the range operator (two or three periods).
Now, you could populate variables with the range boundaries and use these in the find request instead of the fields, but it is much more convenient to skip stored find requests altogether and do simply:
Enter Find Mode [ ]
Set Field [ Pre Construction::Bid Date; Bid Date Search::Start Date & ".." & Bid Date Search::End Date ]
Perform Find [ ]
Of course, we are assuming that the Start Date and End Date fields are global fields.