ms-access


Calculating days between dates and parameters in MS Access


I'm trying to write a query that allows me to get records for all users whose items are more than X number of days overdue. I want to be able to specify whether that number be 30 or 40 or 50. I am able to get the results I need when I specify a specific number in the sql query:
SELECT USER_TRANSACTIONS.PATRON_ID, USER_TRANSACTIONS.CURRENT_DUE_DATE,
DateDiff("d",USER_TRANSACTIONS.CURRENT_DUE_DATE,Date()) AS Expr1
FROM USER_TRANSACTIONS
WHERE (DateDiff("d", USER_TRANSACTIONS.CURRENT_DUE_DATE, Date()))>50
However, when I try to use a parameter in place of the number, 50. And then type in the number 50 when I run the query and am prompted
SELECT USER_TRANSACTIONS.PATRON_ID,USER_TRANSACTIONS.CURRENT_DUE_DATE,
DateDiff("d",USER_TRANSACTIONS.CURRENT_DUE_DATE,Date()) AS Expr1
FROM USER_TRANSACTIONS
WHERE (DateDiff("d", USER_TRANSACTIONS.CURRENT_DUE_DATE, Date()))>[MinimumNumDays]
The query gives me everything instead of limiting the records to those overdue by more than 50 days. What am I missing??

You will need to add [MinimumNumDays] as an Integer query parameter. (Click [?] Parameters on the upper right the query builder)

if you are running this query from a form you can add an unbouand text box to the form. Enter the number of days in this. In query definition right click on in the criteria row for Expr1 and select build, locate your text box in
forms -> Loaded Forms -> your form
double click on it and click OK


Related Links

How to structure my query for a MS Access Chart?
Complicated crystal report help - Semicolon in the database field value
VBA procedure to import csv file into access
does backend path length affect frontend speed?
MS Access Syntax error
Query not running with “*” criteria
Acess 2007 one-to-many relationship counting
MS Access Form Load
Access 2003: Determine whether one or all of 4 fields exist in table
navigating through table records in Access VBA
Save record with default form values
Sub Reports In Main Report - Access Reports
Is it possible to click on a report record to open relevant form in Access using VBA
MS Access: custom paper size
DSum function in vba
Access mdb file, the DB keeps trying to connect to a remote server

Categories

HOME
pypi
webpack
amazon-ec2
mediawiki
google-play
plone
fft
relayjs
frameworks
dxl
blueprintjs
fingerprint
onelogin
mouse
add
adfs
slick-slider
awesome-wm
reveal.js
handsontable
jplayer
alignment
phaser
hapi
circuit
facebook-page
reactcsstransitiongroup
code-review
beyondcompare
nodatime
riot.js
wkwebview
realex-payments-api
h2db
django-storage
kannel
traffic
bootstrap-material-design
google-cloud-nl
nouislider
microsoft-chart-controls
tinymce-4
stormpath
titanium-mobile
kendo-ui-grid
vsts-build-task
hybridauth
gammu
http-referer
y86
force-layout
stacked
retina-display
twitch
ensembles
fedex
sql-server-agent
turbogears
vao
flashair
scorm
osx-mavericks
errordocument
pnotify
diagnostics
crypt
ifs
zendesk-app
jspdf-autotable
color-profile
angular-strap
jquery-filter
nxt
mongocsharpdriver
plottable.js
holder.js
two-factor-authentication
iad
varargs
mono-embedding
dia
clicktag
asp.net-dynamic-data
id3v2
java-metro-framework
code-access-security
project-planning
transcoding
ember-charts
centos5
.aspxauth
padarn
django-nonrel
mqx
lcs
http-unit
cassini-dev
delphi-6
libstdc++
bluepill
manchester-syntax
tridion-worldserver
subscript
gcj
web-application-design
ext3
fixed-width
user-friendly
mdac
misv





Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization