UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Filtering According To Another Value, Access 2007    
 
   
Sailor
post Dec 25 2017, 03:36 PM
Post#1



Posts: 57
Joined: 14-December 16



I have a table with the following fields :

names (text) ----------checked (yes/no)

I need to apply filter for some names with a condition from another record
for ex:

show name John
where name Robby----- checked = false

is that possible by using form.filter ?
This post has been edited by Sailor: Dec 25 2017, 03:51 PM
Go to the top of the page
 
GroverParkGeorge
post Dec 25 2017, 05:57 PM
Post#2


UA Admin
Posts: 33,016
Joined: 20-June 02
From: Newcastle, WA


Possibly...

--------------------
Go to the top of the page
 
projecttoday
post Dec 25 2017, 06:49 PM
Post#3


UtterAccess VIP
Posts: 9,819
Joined: 10-February 04
From: South Charleston, WV


Just 2 fields? How do you relate John to Robby?

--------------------
Robert Crouser

My company's website
Go to the top of the page
 
Sailor
post Dec 25 2017, 11:43 PM
Post#4



Posts: 57
Joined: 14-December 16



each record is contains (name,check)

my table structure looks as follows :

names .............................. checked
------------------------------------------
John.....................................yes
William .................................no
Edward..................................no
.
.
.

all I need is how to show John only when Edward is false , for example ?
Go to the top of the page
 
projecttoday
post Dec 25 2017, 11:58 PM
Post#5


UtterAccess VIP
Posts: 9,819
Joined: 10-February 04
From: South Charleston, WV


So for the above, what do you type in to open the form? What is the result you want to see?

So for the below, what do you type in to open the form? What is the result you want to see?

John.....................................no
William .................................no
Edward..................................no

So for the below, what do you type in to open the form? What is the result you want to see?

John.....................................yes
William .................................no
Edward.................................yes




--------------------
Robert Crouser

My company's website
Go to the top of the page
 
Sailor
post Dec 26 2017, 12:43 AM
Post#6



Posts: 57
Joined: 14-December 16



The result should be displayed on a subform as a datasheet
the filter suppose to be applied on the OnLoad event for that subform
so we should have only one name to be displayed on the subform
but that name should be displayed only if a specific name have its (yes/no) checkbox is unchecked

I have tried to do the following VBA query :

CODE
Private Sub Form_Load()
Me.Form.Filter = "[names] = 'John' and [is_checked]=False and [names] = 'William' and [is_checked]=False"
end sub


but it displays nothing .
This post has been edited by Sailor: Dec 26 2017, 12:44 AM
Go to the top of the page
 
projecttoday
post Dec 26 2017, 01:04 AM
Post#7


UtterAccess VIP
Posts: 9,819
Joined: 10-February 04
From: South Charleston, WV


What's the purpose of the subform if it's only going to have 1 record? I think you want something like
If Dlookup("[is_checked]","table1","[names] = 'John'") = False Then
If Dlookup("[is_checked]","table1","[names] = 'William'") = False Then
'display message
End If
End If


--------------------
Robert Crouser

My company's website
Go to the top of the page
 
Sailor
post Dec 26 2017, 01:41 AM
Post#8



Posts: 57
Joined: 14-December 16



OK
what if we need to display a set of records
but should exclude one of them if a specific one is checked ?
Go to the top of the page
 
Sailor
post Dec 26 2017, 02:31 AM
Post#9



Posts: 57
Joined: 14-December 16



Any suggestion ?
Go to the top of the page
 
projecttoday
post Dec 26 2017, 07:35 AM
Post#10


UtterAccess VIP
Posts: 9,819
Joined: 10-February 04
From: South Charleston, WV


So we're back to that. Give an example.

--------------------
Robert Crouser

My company's website
Go to the top of the page
 
GroverParkGeorge
post Dec 26 2017, 07:38 AM
Post#11


UA Admin
Posts: 33,016
Joined: 20-June 02
From: Newcastle, WA


Based on what I've seen so far, I don't think you've given us the total picture. And also based on what we've seen so far, there is no easily achievable solution.

You've offered three people's names and said that if one of them is "checked' one of the other names should be displayed in a subform and the other one hidden. But that's simply one possible result, based on those three specific values and a rule you haven't explained.

Creating a general rule that would work for dozens of people's names in various combinations of checked and unchecked statuses requires an explanation of the REASON for the rule and how you go about deciding which value triggers which other names to be shown or hidden.

Can you explain, please, the context in which you'll apply this solution?

--------------------
Go to the top of the page
 
Sailor
post Dec 26 2017, 09:29 AM
Post#12



Posts: 57
Joined: 14-December 16



Mr GroverParkGeorge , I guess you haven't read my posts well

QUOTE (GroverParkGeorge)
You've offered three people's names and said that if one of them is "checked' one of the other names should be displayed in a subform and the other one hidden. But that's simply one possible result, based on those three specific values and a rule you haven't explained.

Creating a general rule that would work for dozens of people's names in various combinations of checked and unchecked statuses requires an explanation of the REASON for the rule and how you go about deciding which value triggers which other names to be shown or hidden


I have said one specific name (John) for example is to be displayed if a specific one (Whatever) was unchecked
three records are more than enough to give an idea of such situation .

QUOTE (Sailor)
all I need is how to show John only when Edward is false , for example ?


QUOTE (Me)
The result should be displayed on a subform as a datasheet
the filter suppose to be applied on the OnLoad event for that subform
so we should have only one name to be displayed on the subform
but that name should be displayed only if a specific name have its (yes/no) checkbox is unchecked


the conditions are to be applied on two specific names only (one is unchecked / the other is displyed)

anyway I have change the design of my table to contains an extra (yes/no) field , to specify the rule I need

Thanks every one who posted here .
This post has been edited by Sailor: Dec 26 2017, 09:37 AM
Go to the top of the page
 
GroverParkGeorge
post Dec 26 2017, 09:44 AM
Post#13


UA Admin
Posts: 33,016
Joined: 20-June 02
From: Newcastle, WA


Certainly, if your table contains ONLY THREE names, then yes, it would be possible to write the VBA required.

Can you confirm, then, that this table will always contain those three names and only those three names? Never a fourth name and never a different name in place of one of those listed?

--------------------
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th July 2018 - 02:01 PM