473,472 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Filtering Subform from Combobox values

33 New Member
Hi

I have a form viewbookings on which I have a combobox - filtgroupname & a subform bookingsubform. What I'd like to have is - the user chooses a name from the combobox & it filters the subform for bookings for the group chosen. I tried this several times yesterday with no success (I haven't got the code cos in my frustration I deleted it)

Thanks in advance
Jul 6 '07 #1
4 1501
glamster7
33 New Member
I am alright with setting up the combobox - but the wheels seem to come off when I do the event on After Update
Jul 6 '07 #2
Scott Price
1,384 Recognized Expert Top Contributor
Assuming you're running Access 2003?

This is the code I've used to do just what you're trying to do (thanks to all for their help on this site!):


[code=vb]Private Sub cboHistYearSel_AfterUpdate()
Dim SelYear As Integer
Me!sfrmHistory.Requery
SelYear = Me!cboHistYearSel.Value
Me.sfrmHistory.Form.Filter = "Year = " & SelYear
Me.sfrmHistory.Form.FilterOn = True
End Sub[/CODE=vb]

This code example is to filter a subform named sfrmHistory according to a new year chosen in the combo box named cboHistYearSel.

Change the names to match your subform name, combo box name, and if needed the variable to String or Variant and it should work!
Jul 6 '07 #3
glamster7
33 New Member
Cheers Scott - will give that a try & let ya know how I go
Jul 6 '07 #4
glamster7
33 New Member
Does the job nicely - thanks for that
Jul 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
1
by: Trent | last post by:
I am in the design phase of a new database and am having a devil of a time with a subform. I have three tables that relate to problem - Suppliers tbl, Customers tbl and a SuppliersCustomers tbl....
1
by: Mariel | last post by:
Hello, I hava a main form F1, form with a subform F2 in datasheet view. There is a combobox in the main form C1, and a combobox C2 in the subform. I want the dropdown options of the combobox...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.