Multiple Filters in a Form (1 Viewer)

lunchbox

New member
Local time
Today, 21:19
Joined
Sep 27, 2017
Messages
5
Hi There,

I've not used access for a while and I'm trying to make my work life easier with a database.

So far all going well until I get to a part where I want to add a shipping section to determine from the couriers matrix how much the shipping will cost with what I thought to be a simple set of filters in a form.

I basically want have 3 combo box's and one box that displays the price.

The table has 5 columns; ID, Zone, Type, Size, and Price.

Ive tried creating a form just based on the table but I can filter with one combo box but not all 3.

I tried creating 3 separate tables for each of the combobox fields but then I just get random prices displayed that are nothing to do with what Ive selected.

Could someone point me in the right direction please its driving me nuts as I'm sure its easy but as I've not used access for a few years the info isn't flooding back to me....


Thanks in Advance
 

Ranman256

Well-known member
Local time
Today, 16:19
Joined
Apr 9, 2015
Messages
4,338
build the 'where' clause by cycling thru all the controls....
executed at a button called FILTER click event


Code:
'----------------
sub btnFilter_click()
'----------------
dim sWhere as string 

sWhere = "1=1"
if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"

If sWhere = "1=1" Then
  Me.FilterOn = False
Else
  Me.Filter = sWhere
  Me.FilterOn = True
End If
end sub
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 21:19
Joined
Jul 9, 2003
Messages
16,424
I'm not getting enough information to be able to point you in the right direction. Please could you give some examples of the type of calculation you want to perform?
 

Users who are viewing this thread

Top Bottom