looking up value in combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted
 
Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Ted said:
it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


Ted said:
i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


SteveS said:
Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Ted said:
it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


Ted said:
i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Ted said:
steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


SteveS said:
Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Ted said:
it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:

i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




SteveS said:
Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Ted said:
steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


SteveS said:
Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:

i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:

Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:

steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:


Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:


it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:


i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
hey steve,

the title of the 2nd box is "Title_" (with the underscore.

i tried modifying the vba per your model below. the sql was the same. and
the effect is really weird: once primary is chosen the only thing i can get
into the other combo boxes is the 'Enter' :-(

-ted

SteveS said:
Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:

Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:


steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:


Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:


it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:


i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




SteveS said:
Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:

Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:


steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:


Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:


it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:


i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
Well, I don't know what you table structure is like , but the first two record
sources look fine; I'm not sure about the third.

Have you tried the SQL for the third combo box like this?

SELECT Protocol.[IRB #]
FROM Protocol
WHERE Protocol.Description = [Forms]![Temporary Look Up]![Title];


Why do you requery the combo box in its afterupdate event? It's not necessary.
Private Sub Primary_AfterUpdate()
Me.Primary.Requery
---snip--

Again, this is the way I think the after update events should be:

Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to update items
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.Title = "Enter"
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()

End Sub



If you want, email me a copy (compact/repair, then winzip it - it should be
under 1 meg) and I'll see if I can get it to work.

Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




:

Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:



Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:



steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:



Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?

ie:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
'-----snip--------


There are three SQL statements that are(?) the record sources for three
combo boxes(?), but you didn't provide the respective control names. (Or the
4th control)


It looks like the two tables are related 1-to-1 on field [PrimaryID]. Is
this right?

----
So, if you could provide the structure of the tables (fieldNames & dataTypes)
The control names and type of control (combo ,list ,text box) and a small
sample of the data and the results expected, it would be very helpful.

I'm not trying to be harsh, but without knowing this I can only give you a
general idea of how to try and fix the problems.

Or you could send me the mdb, if the size is under 1 meg after you do a
compact/repair and then Winzip it. There should be the form & the two tables
with some data (20 -30 records each).

I have an Yahoo account - my ID is limbim53 you know how to make a valid
email address ;)


We *can* get this working....
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:



it occurred to me that i might've used some of the code to help with this, so
here's the vba:

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter title"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(1)
End Sub


i'm using and here's the SQL queries:

SELECT DISTINCT Primary.PrimDescription FROM [Primary] ORDER BY
Primary.PrimDescription;

SELECT Protocol.Description FROM [Primary] INNER JOIN Protocol ON
Primary.PrimaryID = Protocol.PrimaryID WHERE
(((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #], Protocol.PrimaryID, Protocol.Description FROM
Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID WHERE
(((Protocol.PrimaryID)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

hth,

-ted


:



i am using a2k.

i have a form called 'Temporary Look Up' with four controls on it. the 2nd,
3rd and 4th are inter-related in the sense that when the first is chosen from
the combo box list of availables, it provides a list of available values for
the 2nd one (conditioned on the choice of the 1st). when the 2nd is chosen,
it uniquely determines the value of the third.

whenever i determine the values of the first two, the value available in the
combo box of the 3rd's is blank.

does this speak for some obvious offense i have committed?

-ted
 
steve, i tried answering your latest reply but i'm reprising it 'cause i
don't think it got uploaded....

the result of using your code/sql is as follows: after selecting a 'primary'
the word 'Enter' appears in the next two controls and the cursor moves down
one to the 'Title' control. after selecting a value for 'Title', the word
'Enter' re-populates the 'Title' control and the 'IRB_Number' control goes
blank.

still no cigar.

-ted


SteveS said:
Well, I don't know what you table structure is like , but the first two record
sources look fine; I'm not sure about the third.

Have you tried the SQL for the third combo box like this?

SELECT Protocol.[IRB #]
FROM Protocol
WHERE Protocol.Description = [Forms]![Temporary Look Up]![Title];


Why do you requery the combo box in its afterupdate event? It's not necessary.
Private Sub Primary_AfterUpdate()
Me.Primary.Requery
---snip--

Again, this is the way I think the after update events should be:

Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to update items
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.Title = "Enter"
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()

End Sub



If you want, email me a copy (compact/repair, then winzip it - it should be
under 1 meg) and I'll see if I can get it to work.

Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




:

Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)


Ted wrote:

hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:



Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:



steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:



Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?
 
Sorry. I deleted the wrong line in the second afterupdate code. It should be:

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.IRB_Number = "Enter" '<<< this line
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub





Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
steve, i tried answering your latest reply but i'm reprising it 'cause i
don't think it got uploaded....

the result of using your code/sql is as follows: after selecting a 'primary'
the word 'Enter' appears in the next two controls and the cursor moves down
one to the 'Title' control. after selecting a value for 'Title', the word
'Enter' re-populates the 'Title' control and the 'IRB_Number' control goes
blank.

still no cigar.

-ted


:

Well, I don't know what you table structure is like , but the first two record
sources look fine; I'm not sure about the third.

Have you tried the SQL for the third combo box like this?

SELECT Protocol.[IRB #]
FROM Protocol
WHERE Protocol.Description = [Forms]![Temporary Look Up]![Title];


Why do you requery the combo box in its afterupdate event? It's not necessary.
Private Sub Primary_AfterUpdate()
Me.Primary.Requery
---snip--

Again, this is the way I think the after update events should be:

Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to update items
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.Title = "Enter"
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()

End Sub



If you want, email me a copy (compact/repair, then winzip it - it should be
under 1 meg) and I'll see if I can get it to work.

Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




:



Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)


Ted wrote:


hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:




Glad you got it working...

I'll hang around for a while <g>.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


:




steve,

many thanks for the good advice....i had occasion to re-examine the query
behind one of the controls and found the recursive occlusion responsible for
the failure to resolve the IRB number controls value. it's a good thing you
veni, vidi velcroed :-)

stick around,

-ted


:




Ted,

It sounds like you are describing what is (commonly) called "cascading combo
boxes".

Unfortunately, you didn't use a naming convention and my crystal ball is in
for repairs :) , so it very difficult to determine just what is what.

This is what I did figure out:

There is at least four controls: 3 that are combo boxes, 1 that is ??

There is a control named "Primary"
There is a control named "Title"
There is a control named "IRB_Number" (which might be a listbox)

There is a table named: Primary

with fields: PrimaryID, long, PK
PrimDescription, text


and a table named: Protocol

with fields: PrimaryID, long (PK or FK)
Description, text
IRB #, ???


The two afterupdate subs don't make sense; why are you requering the same
control right after you changed it?
 
hi steve,

still no cigar (even w/ the corrected code).

it seems to be able to 'automatically' populate the IRB_Numbers for some but
not for other combinations of 'Primary' and 'Title' control values -- even
though in every instance the IRB_Number is present in the underlying table!

since this is not a regular/production application but an ad hoc solution,
i've decided to let the 'IRB_Number' control accept manually entered values
not on the list which though not cool gets the same results.

thanks for the bandwidth!

-ted


SteveS said:
Sorry. I deleted the wrong line in the second afterupdate code. It should be:

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.IRB_Number = "Enter" '<<< this line
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub





Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
steve, i tried answering your latest reply but i'm reprising it 'cause i
don't think it got uploaded....

the result of using your code/sql is as follows: after selecting a 'primary'
the word 'Enter' appears in the next two controls and the cursor moves down
one to the 'Title' control. after selecting a value for 'Title', the word
'Enter' re-populates the 'Title' control and the 'IRB_Number' control goes
blank.

still no cigar.

-ted


:

Well, I don't know what you table structure is like , but the first two record
sources look fine; I'm not sure about the third.

Have you tried the SQL for the third combo box like this?

SELECT Protocol.[IRB #]
FROM Protocol
WHERE Protocol.Description = [Forms]![Temporary Look Up]![Title];


Why do you requery the combo box in its afterupdate event? It's not necessary.
Private Sub Primary_AfterUpdate()
Me.Primary.Requery
---snip--

Again, this is the way I think the after update events should be:

Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to update items
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.Title = "Enter"
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()

End Sub



If you want, email me a copy (compact/repair, then winzip it - it should be
under 1 meg) and I'll see if I can get it to work.

Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

Ted wrote:

Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




:



Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)


Ted wrote:


hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:




Glad you got it working...

I'll hang around for a while <g>.
 
steve, i noticed that when the IRB_Number fails to get entered into its
control it 'tends' to be (about 90% of the time) when the 'Title' that was
chosen was quite lengthy. I don't think it ever fails when the 'Title' is a
short one. that seems kind of weird to me. i checked out the types of
controls i designated the 'Title' to be and it's 'memo' so i wouldn't think
we were running up against the wall of 255 characters length.

make any sense to you?

-ted

SteveS said:
Sorry. I deleted the wrong line in the second afterupdate code. It should be:

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.IRB_Number = "Enter" '<<< this line
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub





Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)
steve, i tried answering your latest reply but i'm reprising it 'cause i
don't think it got uploaded....

the result of using your code/sql is as follows: after selecting a 'primary'
the word 'Enter' appears in the next two controls and the cursor moves down
one to the 'Title' control. after selecting a value for 'Title', the word
'Enter' re-populates the 'Title' control and the 'IRB_Number' control goes
blank.

still no cigar.

-ted


:

Well, I don't know what you table structure is like , but the first two record
sources look fine; I'm not sure about the third.

Have you tried the SQL for the third combo box like this?

SELECT Protocol.[IRB #]
FROM Protocol
WHERE Protocol.Description = [Forms]![Temporary Look Up]![Title];


Why do you requery the combo box in its afterupdate event? It's not necessary.
Private Sub Primary_AfterUpdate()
Me.Primary.Requery
---snip--

Again, this is the way I think the after update events should be:

Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to update items
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub

Private Sub Title_AfterUpdate()
'clear value of combo box
Me.Title = "Enter"
'requery to update items
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()

End Sub



If you want, email me a copy (compact/repair, then winzip it - it should be
under 1 meg) and I'll see if I can get it to work.

Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)

Ted wrote:

Steve, the following is the SQL I’m using in my three cascading queries in
linear order, followed by the relevant VBA:

SELECT DISTINCT Primary.PrimDescription
FROM [Primary]
ORDER BY Primary.PrimDescription;

SELECT Protocol.Description
FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

SELECT Protocol.[IRB #]
FROM Protocol INNER JOIN [Primary] ON Protocol.PrimaryID = Primary.PrimaryID
WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]) AND
((Protocol.Description)=[Forms]![Temporary Look Up]![Title]));

Option Compare Database
Option Explicit

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title.SetFocus
Me.Title = "Enter"
Me.Title.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

Private Sub Title_AfterUpdate()
Me.Title.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

Private Sub IRB_Number_AfterUpdate()
Me.IRB_Number.Requery
End Sub

I have changed the name of the “Title_†(w/ the underscore) field to just
“Titleâ€.

This ‘seems’ to work. The intent of the

Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)

Code immediately above is to enter the value of the first entry in the list
returned from the 3rd query into the control – my understanding is the IRB
number is uniquely defined by the combination of the two controls preceding.

The ‘weird’ thing about the way it works is that sometimes it will enter an
IRB number in the control and other times it won’t even though there are IRB
numbers found in the ‘Protocol’ table for the Primary and Title combination
the user chooses L . When the IRB number is not entered, clicking on the
combo box arrow results in what looks like a blank value.




:



Yes, I'm still watching this thread :)


Is the name of the second combo box "Title_" or "Title". The after update code
has two underlines; the extra underline makes the code a different subroutine.


This is the way I would set the properties of the combo boxes. (of course, I
can't see your tables or form, so it is mostly a guess):

Combo 1 *****

Name = Primary (I would name it cboPrimary)

Rowsource = SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;

AfterUpdate code =
Private Sub Primary_AfterUpdate()
'clear value of combo boxes
Me.Title_ = "Enter"
Me.IRB_Number = "Enter"
'requery to set rowsource
Me.Title_.Requery
Me.IRB_Number.Requery
'move to combo box
Me.Title_.SetFocus
End Sub


Combo 2 ******

Name = Title_ (maybe it should be "Title"?)

Rowsource = SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));

AfterUpdate code =
Private Sub Title__AfterUpdate()
'clear value of combo box
Me.Title_ = "Enter"
'requery to set rowsource
Me.IRB_Number.Requery
'move to combo box
Me.IRB_Number.SetFocus

'I don't know what this is supposed to do!!!
'Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub



--
Steve S.
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)


Ted wrote:


hey steve,

i'm back and scratching my head 'cause it's been a while since i got it to
work and now it isn't for some reason. so, i'm hoping you're reading these
and will reset the clock so to speak and give you what i know:

the user selects a field called 'Primary' using the SQL

SELECT DISTINCT Primary.PrimDescription

FROM [Primary]

ORDER BY Primary.PrimDescription;


in a combo box where the 'AfterUpdate' VBA is:

Private Sub Primary_AfterUpdate()
Me.Primary.Requery
Me.Title_.SetFocus
Me.Title_ = "Enter"
Me.Title_.Requery
Me.IRB_Number = "Enter"
Me.IRB_Number.Requery
End Sub

once picked, the user selects the 'Title' from the next combobox using SQL

SELECT Protocol.Description

FROM [Primary] INNER JOIN Protocol ON Primary.PrimaryID = Protocol.PrimaryID

WHERE (((Primary.PrimDescription)=[Forms]![Temporary Look Up]![Primary]));


where the 'AfterUpdate' VBA is:


Private Sub Title__AfterUpdate()
Me.Title_.Requery
Me.IRB_Number.SetFocus
Me.IRB_Number.Requery
Me.IRB_Number.Value = Me.IRB_Number.ItemData(0)
End Sub

which 'should' populate the last combobox, IRB_Number with the uniqeu value
of the IRB_Number.

only it doesn't!!?? it just gives you a blank value when you click on the
down arrow.

any thoughts?

-ted




:




Glad you got it working...

I'll hang around for a while <g>.
 
No, it doesn't make any sense to me. I looked at other databases and couldn't
see any reason for the behavior you describe.

Could be a timing issue. Without seeing all of the code, it is hard to tell.


Sorry I couldn't be more help.
 
Steve,

Thanks for trying anway.

Best,

Ted

SteveS said:
No, it doesn't make any sense to me. I looked at other databases and couldn't
see any reason for the behavior you describe.

Could be a timing issue. Without seeing all of the code, it is hard to tell.


Sorry I couldn't be more help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top