Query criteria

david.paton

Registered User.
Local time
Today, 13:56
Joined
Jun 26, 2013
Messages
338
I am having some trouble specifying query criteria. I have a table called tblDivisions which has the fields ID and tblDivisionsTown. I have another table called Legatees. Each legatee is from a town and I have another form that contains a sub form to show the legatees from a given town. The sub form has the source of a query that shows the legatee information.

I used to have all the legatee information displayed but I have just decided that I should separate the legatees by town and I just didn't know how to do it.

I tried making a query and if it worked I was going to adjust it slightly for each town and attach it to buttons on the sub form. I included the legatee fields from the legatee table but then included the id field from tblDivisions, changed the total column to where and entered ="2", which is the criteria for the town I was testing but that still didn't work.

Could I have a bit of help please?

Thanks
 
Make a continuous form to show all persons. (Legatees)
In the header ,put an unbound combo box. The combo would have a list of all towns. (Query all towns)

When user picks a town from the list,code will filter all those in that town:
Code:
Sub cboBox_afterupdate()
If isNull(cboBox) then
   Me.filterOn= false
Else
     Me.filter = "[town]='" & me.cboBox & "'"
     Me.filterOn= true
End if
End sub
 
Sorry if I sound a bit ignorant, but I don't know much about coding. With the code you gave me, what do I need to replace with names from my database and what do I replace them with?

Thanks,
Dave
 

Users who are viewing this thread

Back
Top Bottom