473,439 Members | 1,935 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,439 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 1638
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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...
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
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.