[Solved] Date as input variable to a query?

Creating tables and queries
Post Reply
akillenb
Posts: 4
Joined: Fri Jan 07, 2011 8:44 pm

[Solved] Date as input variable to a query?

Post by akillenb »

I'm a newb, so forgive me if this has an obvious answer.
I need to be able to structure queries based on a specific date as input.
While I can put a conditional in the query as, for instance, :MMDDYY, when the query is run, all it shows is the MMDDYY, and I cannot determine how to get the "/" characters to display, or to get the field treated as requiring a date as input.
The ideal or ultimate solution would be to have a selectable calendar appear as the input popup.
Last edited by akillenb on Sat Jan 08, 2011 9:27 pm, edited 1 time in total.
OpenOffice 3.2.1 on Windows Vista and XP
User avatar
r4zoli
Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Date as input variable to a query?

Post by r4zoli »

The parameter query use ISO date format: YYYY-MM-DD.
You can ad :start_date it will show as start_date, when dialog opens add 2011-01-01.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
akillenb
Posts: 4
Joined: Fri Jan 07, 2011 8:44 pm

Re: Date as input variable to a query?

Post by akillenb »

Thanks. It's not so much a question of whether or not I can use a date as input - nearly anything I put after the ":" will cause a query input popup - what I'd like to do, is make it obvious that it needs to be a date, and what the format needs to be. The current format definition in the table is MM/DD/YY.
OpenOffice 3.2.1 on Windows Vista and XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Date as input variable to a query?

Post by Villeroy »

The format definition is completely irrelevant. You can always enter 2010-12-31 (ISO) regardless of format. Depending on the respective application locale any of 31.12.10, 31/12/10 or 12/31/10(US) stores the same date value to the field.
In a form you can use date controls with or without pop-up calendar or masked fields to enter digits only. And yes, subforms can be bound to parameter queries with parameters substituted by the parent form.
http://user.services.openoffice.org/en/ ... 944#p62944 (date parameter in form)
http://user.services.openoffice.org/en/ ... 36#p102636 (date-time input mask)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
akillenb
Posts: 4
Joined: Fri Jan 07, 2011 8:44 pm

Re: Date as input variable to a query?

Post by akillenb »

Thanks again. But let me try to rephrase the question again.
I can make it work, since I know what the input parameter needs to be.
If I were to say to a non-technical user: here, use this form, they cannot tell that the input parameter needs to be a date, or what, exactly they need to enter.
Assuming that the query was to be used by multiple non-technical people, what sort of value could i substitute, for mmddyy in the criterion field to a) make it obviously a date, and b) what format it should be:
screen capture
screen capture
OpenOffice 3.2.1 on Windows Vista and XP
User avatar
r4zoli
Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Date as input variable to a query?

Post by r4zoli »

It depends on your users understanding of pop-up message, if it contain start-date and end_date i presume they will try to add some date into. It is your task to teach them to use 2010-01-01 (ISO) format in such cases.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Date as input variable to a query?

Post by Villeroy »

akillenb wrote:Thanks again. But let me try to rephrase the question again.
I can make it work, since I know what the input parameter needs to be.
If I were to say to a non-technical user: here, use this form, they cannot tell that the input parameter needs to be a date, or what, exactly they need to enter.
You did not try my example files. One has a calendar control which accepts dates ony and can be turned into a drop-down calendar, the other form takes only the digits in 2010-12-23 13:45:59 .
Why do you employ completely computer illiterate people for data entry? Do you really believe it is cheaper to not raise their level to a certain degree of basic knowlege?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
akillenb
Posts: 4
Joined: Fri Jan 07, 2011 8:44 pm

Re: Date as input variable to a query?

Post by akillenb »

No - I did look at your examples - they didn't do any more than what I already knew how to do, though they used a slightly different approach.

If I were a programmer, or database wizard, I suppose I would know better how to word things to get my answer from others.
I've got forms for data entry with drop-down date selection. What I wanted to do was something like change the label in a query popup, to something more understandable than "Parameters" or to be able to make it a date format showing the dashes "-" or slashes "/" - As to training - since if this were to be used, it would be by whomever was counting donations at a church, it's not possible to train the entire population.
Sigh - guess we'll call it solved, for now.
OpenOffice 3.2.1 on Windows Vista and XP
Post Reply