What function to use

JaneMore

New Member
Joined
Apr 30, 2016
Messages
14
I am not sure what function to use for an Access query but I want to say something like this

If membership expire date has past
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Do you need a function for that, wouldn't the more than operator sufffice?

Expired:Iif([MemberShipExpireData]>Date, 'Expired', 'Not expired')
 
Upvote 0
another option (with an Access Query) is to use a WHERE clause:

Code:
SELECT * FROM Table1 WHERE [MemberShipExpireDate] < Date()
 
Upvote 0
I am sorry my post was cut off for some reason

What I was trying to write in Pseudocode was

Code:
If membership expire date has pasted print "Inactive" else "Active" but if Denied or
terminated then print "other"
 
Upvote 0
Where would Inactive/Active/Other appear and where would Denied/Terminated be indicated?
 
Upvote 0
Where would Inactive/Active/Other appear and where would Denied/Terminated be indicated?

Hi Norie,

I am building query in access so that I can export the results in a set format to a 3rd party application. I need to have a field that defines the membership status as either "Active, Inactive, Other" to display that in the export I have to query a number of fields.

FieldNameFieldType
Renewal DateDate/Time
DeniedBoolean
TerminatedBoolean

<tbody>
</tbody>

These are the fields I hope to query, I can get the date by doing < Date() on "Renewal Date" and if it has past then I know they are "Inactive" but then I have to take into account if the member might have a YES in either the Denied or Terminated field to print them with a status of "Other" other wise if the renewal date is in the future then I just print Active.
 
Upvote 0
A nested IIF would work. Also Switch (Shown here with a plug in case nothing matches -- which I think could only happen if renewal date were Null):
Code:
IIF([Denied] = True OR [Terminated] = True, "Other", IIF([Renewal Date] >= Date(), "Active", "Inactive"))
SWITCH([Denied] = True OR [Terminated] = True, "Other", [Renewal Date] >= Date(), "Active", [Renewal Date] < Date(), "Inactive", True, "Unknown")
 
Upvote 0
A nested IIF would work. Also Switch (Shown here with a plug in case nothing matches -- which I think could only happen if renewal date were Null):
Code:
IIF([Denied] = True OR [Terminated] = True, "Other", IIF([Renewal Date] >= Date(), "Active", "Inactive"))
SWITCH([Denied] = True OR [Terminated] = True, "Other", [Renewal Date] >= Date(), "Active", [Renewal Date] < Date(), "Inactive", True, "Unknown")

Thank you this was just what I was looking for thanks for all the help
 
Upvote 0
Sorry to post again on an old thread but wanted to say the custom query for the export to excel that this board and members helped me write is working great. Each week the data is exported out to excel using the custom query.

The only issue is we are only interested in "new" records and we manually delete the older records from the excel export that we imported the week before. We know the record number id each week of where the records start and I could just write.

WHERE ID > 13

But as I am not the one that aways runs the query is there any way to popup a window to ask what record to export from ?
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top