473,414 Members | 1,980 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,414 software developers and data experts.

Cacading Update Combo box not refreshing

daniel aristidou
491 256MB
Hi i have used the following code to create cascade updating combo boxes. the code worked but as soon as i change the selection on the first combo the second combobox goes blank and does not refresh:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo18_AfterUpdate()
  2.     With Me!Combo16
  3.         If IsNull(Me!Combo18) Then
  4.             .RowSource = ""
  5.         Else
  6.             .RowSource = "select chapter" & _
  7.                          "From Tblchapters" & _
  8.                          "Where Subject=" & Me!Combo18
  9.         End If
  10.         Call .Requery
  11.     End With
  12. End Sub
(Ps i am using access 2007)
Am i typing in somthing wrong or is extra code needed?
Sep 1 '07 #1
2 1637
JConsulting
603 Expert 512MB
Hi i have used the following code to create cascade updating combo boxes. the code worked but as soon as i change the selection on the first combo the second combobox goes blank and does not refresh:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo18_AfterUpdate()
  2.     With Me!Combo16
  3.         If IsNull(Me!Combo18) Then
  4.             .RowSource = ""
  5.         Else
  6.             .RowSource = "select chapter" & _
  7.                          "From Tblchapters" & _
  8.                          "Where Subject=" & Me!Combo18
  9.         End If
  10.         Call .Requery
  11.     End With
  12. End Sub
(Ps i am using access 2007)
Am i typing in somthing wrong or is extra code needed?
It worked...but then it didn't work? :o)
you don't need to requery when setting a controls rowsource. It also looked like your rowsource SQL had a spacing issue. Also, if Subject is "text", then you must surround the value with ' ' as shown below.
J

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo18_AfterUpdate()
  2.    With Me!Combo16
  3.         If IsNull(Me!Combo18) Then
  4.             .RowSource = ""
  5.              MsgBox "There are no Chapters for this selection."
  6.         Else
  7.             .RowSource = "select chapter" & _
  8.                          " From Tblchapters" & _
  9.                          " Where Subject='" & Me!Combo18 & "'"
  10.         End If
  11.     End With
  12.  
Sep 1 '07 #2
daniel aristidou
491 256MB
thanks
very much :-)
Sep 2 '07 #3

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

Similar topics

1
by: Maria Joao | last post by:
I have two synchronized combo boxes and after the selection of the desired record, I need the user to open the related report, by pressing a button. My problem is that a combo box doesn't update...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
5
by: Ant | last post by:
Hi, (Winform VS2003) I have a combo box bound to a typed data set. When the form loads, the combo box is popluated using a method containing the simple code below: ------------------------...
5
by: keri | last post by:
Hi, I am struggling to learn access and VBA whilst creating a db, progress is slow! So far I have managed to run cascading combo boxes on a form by using a sub in the after update procedure of...
0
by: tech.rawsteak | last post by:
I have a subform that allows a user to enter product orders. I also have a combo box from which the user can select from a list of vendors (from a table) and display the vendor's address in a...
11
by: seangibson | last post by:
Sorry, I've been posting alot of questions regarding cascaded combo boxes here but each time I solve one problem I seem to be faced with a new. This time here's the problem: I've got the combo...
3
by: veenna | last post by:
How can i refresh datagrid in vb.net. I want to display color in one cell in grid but when it loads first time it is working here is my code Public Class Dialog_Colorazione Const YEAR_START...
1
by: OllyJ | last post by:
Hi guys, hope someone can help me out here. It's probably something really simple but i am struggling... I have a form where the user has to enter a job number from a combo box. If they type a...
5
by: handoyo | last post by:
Hi all,i'm trying to show updated data in existing html td.. For example i got column that show last modified datetime,then i want to update data again,the column will changed to current time without...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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
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...

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.