Select record after two months pass after it was added

bekward

Registered User.
Local time
Today, 19:14
Joined
Jan 15, 2014
Messages
11
Hello,
I am new on this forum, but I think I am in right section if not so please forgive me and take it to right section.
i have the database with records of blood donor names, addresses, phone numbers, blood group and that is main with date when blood was taken.
I want to select that donors whose blood was taken 60 days ago or more.
I want to select them somehow.
Can someone help with this.
Thanks in advance.
 
Assuming you want donors who donated 60+ days ago and not in the last 60 days, Google "Allen Browne subqueries." He has an example on that page that's virtually identical to your situation.
 
Create a query and use something like the following expression as criteria in the DonationDate column:
<DateAdd("d",-60,Date())
 
Assuming you want donors who donated 60+ days ago and not in the last 60 days, Google "Allen Browne subqueries." He has an example on that page that's virtually identical to your situation.

Unfortunately I can't find anything related to my issue :(

bob_fitz
<DateAdd("d",-60,Date())
this has syntax error and I couldn't correct it, can you help me?
 
The dateadd should work without problem assuming you are using it in a filter or query...
Also since you are talking about days
<Date() - 60
Will also work

If you want (more exact) 2 months, <Dateadd("M", -2, Date())
 
namliam
This code worked for me, thank you.

I have some questions about this database, maybe it isn't problem if I ask them in this topic also. :)

I have listbox on main window of this database, which is filtered with combobox and one button to reload data in listbox after I need filtered version of this listbox anymore.
I use code for this button
list14.requery
but it doesn't do it.
 
What code do you use to filter the Listbox and to clear it? Perhaps post a database with the form and the required tables?

List14, please use "proper" object names, give them usefull names and dont keep the defaults names... Using the default names is a maintenance nightmare down the road, particular if one form has 20 listboxes, * which frigging one is List14 ?? *
 
What code do you use to filter the Listbox and to clear it? Perhaps post a database with the form and the required tables?

List14, please use "proper" object names, give them usefull names and dont keep the defaults names... Using the default names is a maintenance nightmare down the road, particular if one form has 20 listboxes, * which frigging one is List14 ?? *

my form has only one listbox, I am working on it and because of this it has name list14 :)
I use
Code:
Me!List2.RowSource = "SELECT * FROM base Where [jgupirezusi] Like '*" & Me.Text4.Text & "*';"

but now text4 is changed to combobox and when I choose value it filters listbox with even partial match, I need to filter it with full match.
e.g.
I have I affirmative, I negative, II affirmative, II negative
If I choose I negative, listbox shows II negative too, because of partial match, I want to show only I negative If I choose it and II negative only after I choose it from combobox. :banghead:
I hope wrote my problem clearly. :)
 
Remove the like and the wildcards?
i.e. ..... [jgupirezusi] = '" & Me.Text4.Text & "';"

Also notice:
Me!List2.RowSource
 
Remove the like and the wildcards?
i.e. ..... [jgupirezusi] = '" & Me.Text4.Text & "';"

Also notice:
Me!List2.RowSource

I can't understand your comment :O

I solved all problems, thank you very much.
Only one problem remains :(
I can't reload listbox to show all records again
Code:
sia.requery
sia is a name of listbox
 
Well since you are "hard wireing" your rowsource into the particular value....

Are you resetting your rowsource?
Me!List2.RowSource = "SELECT * FROM base;"

To requery it while there where is there is obviously going to return the same values.
 
Thank you very much :)
I did everything I wanted.
but one another question :)
when I choose value from the combobox that has no match in database listbox becames empty until I click refresh button (made with your help :) ). Can I somehow refresh list in this case?
 
Dont you want the user to experience the empty listbox?
 
Yes, I don't :)
empty listbox when nothing found with selected combobox value in listbox.
 
you can pre-check the query to return records....
something along the lines of:
Code:
dim rs as dao.recordset
dim SQL as string
sql = "Select .... from ... where ... " & ....
Set rs = currentdb.openrecordset(sql )
if rs.count > 0 then
    'fill list box
else
    ' display some message perhaps?
endif
rs.close
set rs = nothing
 

Users who are viewing this thread

Back
Top Bottom