473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Filtering the contents of one combo box on another in a subform

Access 2010, Windows 7 professional

I'm creating a database for my small business (only two of us, so we each have our own "Update Timesheet" form) partly to learn Access.

I have a form called "Alison_Update_Timesheets_F" with a subform called "TimesheetTasks_SF" (based on tables with similar names). I am using a combo box in the header of the "Timesheets" form to find the timesheet I want to edit.

On the main form, I show only the TimesheetID and the TimesheetDate (the query that the main form is based on has already filtered to only "my" recent (within 30 days) timesheets).

On the subform, I have a TimesheetID_F (the linking field to TimesheetID, which works fine).

Then on the subform I have three combo-boxes, then a text field for "Hours", and a checkbox for "Billable".

The combo-boxes are causing the problem.

In the first record on the subform, it works fine.
But as soon as I start to fill in the next record, the previous records entries change.

So I can have:

Company1, ProjectA, Task22 in the first record in the subform.

Then as soon as I pick Company2 in the next record, the project and task details blank in the record above.

I have an "AfterUpdate" event to requery subsequent combos when I change the first in the sequence and I think this may be the cause of the problem.

For example, the code for refreshing the select statement for the Tasks list when I update the Project is:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SelectProjectCombo_AfterUpdate()
  2.     Me.TaskSelectCombo.Requery
  3. End Sub
The Select statement for the tasks (the "Data source") has been built using the query wizard and is:

Expand|Select|Wrap|Line Numbers
  1. SELECT Tasks_T.TaskID, Tasks_T.TaskDescription, ProjectTasks_T.ProjectID_F
  2. FROM Tasks_T INNER JOIN ProjectTasks_T ON Tasks_T.TaskID = ProjectTasks_T.TaskID_F
  3. WHERE (((ProjectTasks_T.ProjectID_F)=[Forms]![Alison_Update_Timesheets_F]![TimesheetTasks_SF].[Form]![SelectProjectCombo]))
  4. ORDER BY Tasks_T.TaskDescription; 
My sub-form is in tabular form, in case that makes a difference.

Oh - and the key to the selected project is written to the TimesheetTasks table as a foreign key (ProjectID_F) so is bound to that, and the same for the Tasks (bound as TaskID_F).

Spent a long time on this and feel I'm going round in circles! Any help gratefully received.
May 28 '13 #1

✓ answered by Rabbit

Don't worry, the data is still there. It's just that on a continuous form, there's no way to have different record sources for each row. You just have to either live with it or not use cascading combo boxes. I don't know of any other way around it. You could try allowing inputs not in the list but that causes other problems of their own.

4 3009
Sorry - meant to say - Access 2010.
May 28 '13 #2
Rabbit
12,516 Expert Mod 8TB
Don't worry, the data is still there. It's just that on a continuous form, there's no way to have different record sources for each row. You just have to either live with it or not use cascading combo boxes. I don't know of any other way around it. You could try allowing inputs not in the list but that causes other problems of their own.
May 28 '13 #3
Thanks. I need the combo boxes or it would be a nightmare. I'll perhaps do a "read only" version for seeing what's there as a sanity check, then. Days when only a couple of entries, not a problem. Days when lots of bits, it will be too easy to forget what's been done and what hasn't.
May 28 '13 #4
zmbd
5,501 Expert Mod 4TB
Indeed, Rabbit is correct:

You may find the following insite articles to be helpful:
Microsoft Access / VBA Insights Sitemap
42.Cascaded Form Filtering
55.Multiple Combobox Filter with Clear Option
168.Example Filtering on a Form.
May 28 '13 #5

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

Similar topics

1
by: Alex | last post by:
Acc97. I have a form which within a subform records machine down time. I have a total of 8 machines. (1-2-3 ect.) What I have been doing is using a combo box linked to the record table to...
3
by: Deborah V. Gardner | last post by:
I would like to use conditional formatting on a subform and have 2 textbox affected. ItemID Qty Cost OrderDate 123 1 10.00 3/3/05 345 ...
2
by: Jedi10180 | last post by:
I have a combo box that has 5 categories in it. When a user clicks on a category in that list, I need to have a second box populate with a list of pdf files that relate only to that category. Then,...
1
by: BartonConstruction | last post by:
Greetings all, I have a main form (frmClients) with two subforms (subVisits) (subAccount). I got the subforms to reflect what the main form is showing by linking master and child fields (I...
1
by: dakboyan | last post by:
Hiya guys, I have a problem here that ive can't seem to solve on my own or through searching around the forums here. I would be glad if someone could assist me. This is actually an events...
1
by: wayniac | last post by:
What I am trying to do is select an item from the combo box and have it displayed in the subform. Then once you scroll though the subform and find the field you like, click on it and it will...
1
by: Tgavin8 | last post by:
Hi I am currently attempting to build a databse for a clothing company. The price can differ for this company depending on the size so in the products table I have the sizes listed in a subform...
6
by: OllyJ | last post by:
Hope you can help guys. I have a scheduling database, the main schedule table contains the following fields: AddedDate Day/Night Machine Arm/Head StockCode ToolNumber
7
by: simulationguy | last post by:
This is causing my some grief :) I have a form that displays records in a tabular format, one field is a combo box that displays values from another table. But I only want some of those values...
5
by: jbrumbau | last post by:
Hello, I have some specification sheets with subforms I have created. I'm having a problem where if you right click and filter/sort any field in the subform (which is tied to the main form in a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.