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

If statement in 'After Update' event makes it miss other code

Hi All,
I have put the following code in the 'After Update' of a combo box:

Private Sub ComboTeam_AfterUpdate()
lblSurnameNotify.Visible = True
Me!ComboSurname = Null
Me!ComboSurname.Requery
If Me.ComboTeam.Value = "*" Then
Me.ComboSurname.RowSource = "SELECT DISTINCT Staff.Surname FROM Staff
WHERE (((Staff.Dept) Like forms!Form1!comboDept));"
Else
Me.ComboSurname.RowSource = "SELECT DISTINCT Staff.Surname FROM Staff
WHERE (((Staff.Team) Like forms!Form1!comboTeam)); "
End If
End Sub

Below this combo box I have the ComboSurname combo box with the
following code:

Private Sub ComboSurname_AfterUpdate()
Me!ComboForename = Null
Me!ComboForename.Requery
lblForenameNotify.Visible = True
End Sub

For some reason, the comboForename combo box does not requery and the
ForenameNotify label does not display.
I have a feeling it is because of the 'If' statement that the code
isn't executing but wondered if anybody could shed any light on this?
Thanks a lot for reading.

R.

Jul 5 '06 #1
3 1913
vi*********@googlemail.com wrote:
: Hi All,
: I have put the following code in the 'After Update' of a combo box:

: Private Sub ComboTeam_AfterUpdate()
<snip>
: lblSurnameNotify.Visible = True
<snip etc>

: Below this combo box I have the ComboSurname combo box with the
: following code:

: Private Sub ComboSurname_AfterUpdate()
: Me!ComboForename = Null
: Me!ComboForename.Requery
: lblForenameNotify.Visible = True
: End Sub

: For some reason, the comboForename combo box does not requery and the
: ForenameNotify label does not display.
<snip>

The code in the ComboSurname_AfterUpdate subroutine won't execute
until user has chosen a surname: is that where it's not
happening? If you want both comboboxes requeried before
proceeding, I'd put both in the ComboTeam_AfterUpdate code.

--thelma

: R.

Jul 5 '06 #2
Hi Thelma,
Thanks for the reply.
A further development. Having messed around a bit and not really known
what i've done, i select a surname and the label still doesn't show but
the forename box requeries (so I am able to select a forename) but if i
then decide to change the surname in the comboSurname box, the forename
stays the same as the previous entry in the forename box. Very odd! Any
ideas??
Thanks again!

R.
Thelma Lubkin wrote:
vi*********@googlemail.com wrote:
: Hi All,
: I have put the following code in the 'After Update' of a combo box:

: Private Sub ComboTeam_AfterUpdate()
<snip>
: lblSurnameNotify.Visible = True
<snip etc>

: Below this combo box I have the ComboSurname combo box with the
: following code:

: Private Sub ComboSurname_AfterUpdate()
: Me!ComboForename = Null
: Me!ComboForename.Requery
: lblForenameNotify.Visible = True
: End Sub

: For some reason, the comboForename combo box does not requery and the
: ForenameNotify label does not display.
<snip>

The code in the ComboSurname_AfterUpdate subroutine won't execute
until user has chosen a surname: is that where it's not
happening? If you want both comboboxes requeried before
proceeding, I'd put both in the ComboTeam_AfterUpdate code.

--thelma

: R.
Jul 5 '06 #3
vi*********@googlemail.com wrote:
: Hi Thelma,
: Thanks for the reply.
: A further development. Having messed around a bit and not really known
: what i've done, i select a surname and the label still doesn't show but
: the forename box requeries (so I am able to select a forename) but if i
: then decide to change the surname in the comboSurname box, the forename
: stays the same as the previous entry in the forename box. Very odd! Any
: ideas??
: Thanks again!

Do you have this in your ComboSurname_AfterUpdate code?

Me!ComboForename = Null

I don't see why the label doesn't show, unless it's hidden
behind one of your controls, but it isn't going to update itself. You
will have to set its Caption property to the forename user chooses,
in a ComboForename_AfterUpdate event [if that's where s/he chooses]

--thelma
: R.
Jul 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: George Stout | last post by:
First off I do not know alot about writing queries to an Access Database from an ASP page. This is why I need help. I have an Events database for 6 colleges in our metro area. On the homepage I...
4
by: CSDunn | last post by:
Hello, I have a combo box (Combo7) that needs to call a function during the After Update event of the combo box. The function resides in an Access 2000 ADP Module called MMAnswerData_code. The...
3
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
5
by: Wing | last post by:
Hi all, I am writing a function that can change the value "Quantity" in the selected row of MS SQL table "shoppingCart", my code is showing below ...
6
by: Dugo | last post by:
I'm trying to use a "keypad" form (with command buttons for numbers 0 thru 9) I developed to allow users to first click a textbox on one form, then click a number on the keypad and have the value...
4
by: Jack | last post by:
Hi, I have a asp page where part of the code is as follows. This builds up the sql statement partially. sql01 = "UPDATE EquipmentTbl SET " sql01 = sql01 & "SerialNumber = '" &...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
19
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
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
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: 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
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
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,...

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.