Retrieving reports from Data Parameters - ms-access-2016

Please I have 2 unbound text boxes namely start date and end date and a command button that generates the report after the 2 dates are inputted.
Now I want a query that matches code to generate report when start and end dates are inputted to produce a report.
Thank you

Related

I need to define a custom work week in MS access

I am trying to create a custom function on a form to define a week Number.
I have created a table that defines the week number.
Example WeekNo, StartDay, End Day
example: WeekNo 1 StartDay = 3/29/2020, End Day 4/4/2020
I have a Date box on my form if I enter a date of 3/29/2020
I would like 1 to be populated in my week number box.
On my form in the row source I have designed a Dlookup query
=DLookup("[WeekNumber]", "tblWeekNumber", "[Startdate] >= " & frmSearchNew.dt_Date & "") & [EndDate] <= frmSearchNew.dtDate
When I change to from view I get the error the record source specified on this form does not exist.
The table tblWeekNumber has the fields ID, WeekNo, StartDay and EndDay.
Where am I going wrong? any help is appreciated.
There are quite a few issues with the DLookup that you have put together.
Firstly, the field that you are looking for and the fields that you are using as criteria do not appear to match those in the table - WeekNumber/WeekNo, StartDate/StartDay, EndDate/EndDay;
Next, the logic for the lookup is wrong. You are trying to find a the week number that has a start date that is greater than the entered date, and an end date that is less than the entered date. What you should be looking for is a start date before the entered date, and an end date after the entered date.
Finally, dates are a bit funny in Access. You need to wrap them in '#' so that Access knows they are dates, and you should also take care to disambiguate them - 03/04/2020 could be either 3rd April or 4th March depending on you nationality.
Putting it all together, the final control source should look like:
=DLookUp("WeekNo","tblWeekNumber","StartDay<=#" & Format([dt_Date],"dd-mmm-yyyy") & "# AND EndDay>=#" & Format([dt_Date],"dd-mmm-yy") & "#")
Regards,

SPSS - pass values of three dates fields into file name

My dataset has three date fields (adate10): Period, Version, and Created. The values for each field are identical for all cases. Let's say the values are:
Period = 10/01/17
Version = 11/15/17
Created = 11/25/17
I would like to pass all three dates into a SAVE OUTFILE='C:\Users\Inventory ? ? ?... command so the file name is:
C:\MyData\Inventory p20171001 v20171115 c20171125.sav
How I can pass the values of these three date fields into the save command? I assume Python is the way to go, but cannot figure out the syntax. I see several solutions at the link below, but they all involve only one date field; I have three. (And even when I tried with one date I couldn't get any of them to work).
http://spssx-discussion.1045642.n5.nabble.com/include-value-from-variable-in-filename-when-saving-td4326879.html
Here you go with a little Python:
BEGIN PROGRAM.
import spss, spssdata
# names of date variables (case sensitive)
varlist = ['period', 'version', 'created']
# fetch dates from dataset and format them to YYYYMMDD
data = spssdata.Spssdata(indexes=(varlist), cvtDates=(varlist))
dates = [date.strftime("%Y%m%d") for date in data.fetchone()]
data.close()
# Create 'save command' command and submit it to spss
spss.Submit(r"""
SAVE OUTFILE = 'C:\MyData\Inventory p{0} v{1} c{2}.sav'.
""".format(*dates))
END PROGRAM.
You can get the results you need with syntax only:
TEMPORARY.
select if $casenum=1.
format Period Version Created (f11).
write out="C:\MyData\save with dates in name.sps"
/"save out='C:\MyData\Inventory p", Period, " v", Version, " c", Created, ".sav' ".
exe.
insert file="C:\MyData\save with dates in name.sps".

Rails - regex to find specific date

In app I build to learn rails, I am working on finding data. Now I have this case: in this text, I want to find the right delivery date.
"delivery date 01/12/2015 delivery note 30112016 invoice date 03.01.2016"
The regex I made get all the dates:
[0-9]{1,2}[-.\/][0-9]{1,2}[-.\/][0-9]{2,4}
How to add the condition that it picks the date preceded "delivery date"?
Add delivery date to the pattern and capture the date:
s[/delivery date\s*(\d{1,2}[-.\/]\d{1,2}[-.\/]\d{2,4})/, 1]
See the online Ruby demo
The 1 argument tells Ruby to only fetch the contents captured within the first capturing group now.
Just in case you are interested in dates that have consistent separators, you may consider using
/delivery date\s*(\d{1,2}([-.\/])\d{1,2}\2\d{2,4})/
^^^^^^^^ ^^
where the separator is captured into Group 2 and the value is re-used later with the backreference \2.

How to insert data from text file where date column has date as "00-00-0000"

I have a text file and it contains one column as "NPA_DATE", in which few rows contain date as "00-00-000".
I am unable to load data where date is in "00-00-0000" format. I am getting the error as "Record 1: Rejected - Error on table MIS_PNPA, column NPA_DATE. ORA-01847: day of month must be between 1 and last day of month". However I want to load the data with NPA_DATE as "00-00-0000" along with other data. All other rows are getting uploaded in database. I use toad for oracle 9.0.1.8
You should add the SQLPlus tag to your original post as this is really a SQLPlus question.
Anyway alter your control file to this to set the date to NULL if it comes in as '00-00-0000' in the data file:
...
npa_date date "DD-MM-YYYY" NULLIF (npa_date="00-00-0000")
...

issue to query data filtered by Date from fusion table

I'm trying to write a small javascript code to query data filtered by date.
If I write the following sentence in my browser, I can get data :
"http://www.google.com/fusiontables/gvizdata?tq=SELECT Date, Poids FROM 3049883"
but if I write the same thing, except I want only data after a certain date :
"http://www.google.com/fusiontables/gvizdata?tq=SELECT Date, Poids FROM 3049883 WHERE Date > 2/29/12"
From the SQL-like API, https://developers.google.com/fusiontables/docs/developers_reference#Select, it should work
I get an error witch is "'internal_error', message:'Could not parse query'"
-Date is a DATETIME format in my fusion table.
-I've tried different format, but I can not get data.
What am I doing wrong?
Thank you very much for your help.
The Date value must be quoted and the format is MM/dd/yy so you must pad single digits with leading zeros.
I had success with:
select Date,Poids from 3049883 where Date >= '02/29/12'
Note: I did not test with gvizdata, just with the FT JSONP API

Resources