Querying based on a data entered in an Access form - ms-access

I've trying to build a query that will look at various fields that are filled out in an associated form. In particular, I'm looking to query for all records > a certain date. This column in the database is stored as a DateTime. Right now, my query looks as follows: (Note that fromDate is just a textbox.
SELECT * FROM ACM_TABLE where DT_TM>[Forms]![Form1]!fromDate
When I replace this with a hardcoded date in the form mm/dd/yyyy, it returns results, but querying based on what is entered in the form does not. Is there some type of conversion I need to do?
Thanks

Related

SSRS: Variable that runs query based on a (date) parameter value entered by user?

So I have a report with approx 15 datasets.
The report has a date parameter so the user can run for whichever date they want.
Each dataset has sql logic that basically determines:
If #parameter_date does not exist in table
then grab the max date from table < #parameter_date
else
use #parameter date
This works and the report works properly as is.
However, I was trying to see if I can have this sql logic in 1 place (rather than 15 times in the beginning of each dataset query) and store it in a global variable, and pass the proper date into the dataset?
When I look at report properties and "variables" it only looks like I can write an expression, not write sql and return a date based on a query.
I'm sure there is an efficient way of doing this, any help would be appreciated.
Thank you

Sort differing date formats in Access?

I have an Access database in which a report is pulled and displayed based on city and state. There is a form where the user selects city and state and a query is run, then a report displayed based on that query. I want to sort the data from the query by Warranty Start date(WSD) then Model #. The problem is that all of the dates aren't in the same format and if I try to format the WSD column as a date field Access Deletes at least 1000 records. Currently all fields are formatted as short text. Is there a way that I can sort the data by date without the format being the same for all? I have attached a screenshot of some records to show the issue.
If you need the sql query I can provide that as well.
If you wish to sort by the date, then you can use:
IIf(IsDate([WSD]), CDate([WSD]), DateSerial(Val([WSD]),1,1)) AS WarrantyDate

How to match text to a defined numeric value

I have a database that has a bunch of survey data that I would like to work with. For several questions, the values are things like "Very important","Not at all likely" and I want to create a calculated field to assign a numeric value to these responses.
I don't want to replace the responses at all since I am going to have a user fill out a form to append the data set. I do want to have a calculated field that will automatically assign a numeric value to a text response.
I would just use a vlookup or an IF function in Excel to do this, but the problem is that Excel can't handle as much data as Access can. I need to set it up so that all Excel will house is a pivot table from the Access database.
Could anyone please tell me if there is a good way to do this? I am just not sure how to do it.
Create a new table with 2 columns: user_value (text) and numeric_value (number). Get all of the user entered values uniquely from the user entered data table with a query (the sigma symbol gives you a group by query). Put these in your new table and assign a numerical value to them. Then you can create an output query which joins your data to the lookup table and retrieves the numerical value for each user entered value.

how to create a multi field query in access 2007?

guys
' i am beginner in access 2007 and i want to create a form that contains many fields (product id, product name, etc and date of transaction) and use a query to search for data
in other words for example i want to enter in this form a date range i.e from 1/1/2013 to 1/03/2013 and search for product x ( attention ) my basic table contains only date of transacton field and not the from, to fields ( the from , to fields i want only to add them in the search form and them to search based on the value or date of transaction field ) please help me
Short but sweet answer;
Create a new "Query" using the GUI. Add your table to the top part. Double-click columns in the table to add them to the output of the Query.
Next, in the query conditions (grid below the name of each field) use brackets "[]" around your from/to dates. E.g. the query condition underneath your date field may be;
"between [MyStartDate] and [MyEndDate]".
Now "run" the query to test it; Access will prompt you for 'MyStartDate' and 'MyEndDate'.
Finally; if you save this query and set it as the "Data Source" for a Form, you may alter the above condition slightly to pull the values automatically from the form itself, so that you are not prompted every time the query runs. E.g. this condition may be;
"between Forms![MyTableForm]![MyStartDate] and Forms![MyTableForm][MyEndDate]".
You will have to play with it a little, but those are the basics.

Querying Zulu Times in MySql

I have events saved in my database which are saved using the date format below.
'2013-09-12T12:14:18Z'
I am trying to get these events using the query below, which returns an empty result set.
SELECT * FROM events WHERE event_time BETWEEN '2013_09-12T12:13:16Z' AND '2013_09-12T12:15:16Z'
Is there a way to somehow search these records?
Since you've stored dates as strings, your query is basically an alphabetical lookup (just like a dictionary). As such, comparing 2013_ with 2013- cannot render the "expected" result.
Solutions:
Fix the column type
Convert column to actual date inside the query
Always use the same format: 2013-...Z