473,396 Members | 2,011 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,396 software developers and data experts.

How to update a combo box in a sub-form from a combo box on a main (single) form

I have a single record form with a combo box to update a field.
The form contains a sub-form with a solitary combo box to be able to select a sub-group of the combo box on the main form.
I have the following code in the row source of the subform:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Class Times].[Class ID], [Class Times].Class
  2. FROM Members LEFT JOIN [Class Times] ON Members.Class = [Class Times].Class
  3. WHERE ((([Class Times].Class)=[Forms]![Form - Current Members]![Class]));
When I change the combo box on the main form the combo list on the subform doesn't refresh? I have tried the following code in the AfterUpdate event of the first combo but it just says it can't find the form?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Class_AfterUpdate()
  2.     Forms![Form - Class Register Subform]![Class ID].Requery
  3. End Sub
Any help on this would be great?
Oct 7 '10 #1
3 1563
nico5038
3,080 Expert 2GB
I would start with renaming your forms using no special characters (like the minus sign "-" and spaces " ").
Access acts sometimes strange on the minus sign :-(

Next use to requery the subform:

Me.sfrmName.Requery

Replace the sfrmName with the name of the subform as recorded in the properties!

Nic;o)
Oct 7 '10 #2
NeoPa
32,556 Expert Mod 16PB
Nico's on the button with this one - except the spelling of .Requery is all.
Oct 9 '10 #3
Many thanks for the replies guys. sorted it now. :-)
Oct 9 '10 #4

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

Similar topics

0
by: compuglobalhypermeganetz0r | last post by:
I am having trouble getting an adapter to update my access database, it gives the error Syntax error in INSERT INTO statement. for Line 98: Adapter.Update(WineDS, "tblWines") Below is my...
0
by: Nithin | last post by:
My code as an txt attachment. I have 2 drop down list boxes that on selection populate text boxes from my database table. I am able to display the correct values in these text boxes. I have 2...
0
by: Lucas Tam | last post by:
Is there a way to call DataAdapter.Update from a Dataview when I have no reference to the DataAdapter? i.e. The DataView is a class variable however the dataadapter is a local variable in a sub...
4
by: Irfan | last post by:
hi, all Two question: 1. When a row is deleted or added (or in other words when there is change) in the datagrid, Is this change actually the change in the underlying dataset ? 2. which...
0
by: Rick | last post by:
Has anyone heard about an ASP.NET 2.0 bug with retrieving values on the fly from a GridView control when in Edit mode ? I have a GridView built with an Edit button. When the Edit button is...
0
by: fitzini | last post by:
Hi all, I need to update multiple rows using a sub query. I've pasted sample code below to hopefully help recreate what I'm trying to do. drop table dummy_test create table dummy_test (cmr...
3
by: Ashton12 | last post by:
Good day all. I am trying to use the OpenRecordSet method to update a field in a table upon the update of a separate table. My code looks like this: Private Sub NewLocation_AfterUpdate() Dim...
2
by: HeavenCore | last post by:
Hello all, i have a process which reads 2 csv files into two different tables (thus there is no real primary key etc) i need to update 1 column in one table (EnterpriseBuffer) with data from...
1
by: vonn | last post by:
There are 4 fields in my database(exlcuding the primary key)...only 3 fields can be successfully updated. the "Section" field returns an error pointing to da.Update(ds, "moreforengineers")? the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.