Values contained in value list of second combobox based on value selected in first combobox.

A

Anthony

Hi

I have a combo box called OperationSubType, which contains a list of values
that I would like to change depending on the value selected in another combo
box called OperationType. I have looked at various other posts and web sites
that assume the row source type is a table/query, and tried to adapt these
to my combo boxes, which have value lists as their row source types rather
than tables/queries.

I have included the following two lines in the AfterUpdate section of the
OperationType combo box:

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A" & "B" & "C"

However, when this code is activated, the following error occurs as a result
of the first line of code:

"Run-time error 438: Object doesn't support this property or method".

Am I able to use a value list in this situation or do I have to create a new
table to hold the values for "OperationSubType"?

Thanks in advance
Anthony
 
M

Michel Walsh

Hi,


Me.OperationSubType.RowSource = "A" & ",B" & ",C"

You have to use the coma delilmiter.

Hoping it may help,
Vanderghast, Access MVP
 
G

Gerald Stanley

Your code should work as it is but here are a couple of
observations.
1. If the rowSourceType of comboBox operationSubType is
always 'Value List', why not set it as such in the Design
View then you would not have to set it in code.
2. If you RowSource code was trying to show three items in
the list, it should have read
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
 
A

Anthony

Hi Michel

Thanks for your response.

I tried your suggestion, but I am still having problems with the run time
error so I can't tell yet whether your suggestion works. Any clues as to how
I can eliminate the error "Run-time error 438: Object doesn't support this
property or method"?

Thanks again
Anthony
 
A

Anthony

Hi Gerald

Thanks for your response.

1. How would I go about creating different value lists in design view?
Wouldn't this limit the value list to only one set of values?

2. I tried your suggestion, but I am still having problems with the run time
error, so I can't tell yet whether your suggestion works. Any clues as to
how I can eliminate the error "Run-time error 438: Object doesn't support
this property or method"?

Thanks Gerald
Anthony
 
G

Gerald Stanley

Anthony

I did not suggest that you could create different value
lists in the Design View - I said that you should set the
RowSourceType to 'Value List' in the Design View so that
you would not need the line of code that is giving you the
problem.

Regards
Gerald Stanley MCSD
 
A

Anthony

Sorry for the confusion, Gerald.

I did as you suggested and set the RowSourceType to "Value List" in design
view and removed the offending line of code.

Now I am having problems with the second line of code:
Me!OperationSubType.RowSource = "A;B;C".

I think it may be "RowSource" and "RowSourceType" that are causing the
problems. Perhaps there is some option or object library(?) that I should
select to make these commands work????

Anthony
 
G

Gerald Stanley

Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
 
M

Michel Walsh

Hi,


Is OperationSubType really a combo box? If so, try on a brand new
application, new from, just that combo box, and a second control that can
get the focus, and the code in the After Update event of the combo box. In
view mode, type something in the combo box, move to the other control, come
back to the combo box, its list should now be made of the three choices, A,
B and C.


If that works in the new application but not in the old, the
technique is right, and so, ***may be*** the old application file is damaged
or corrupted. Try a repair.


Hoping it may help,
Vanderghast, Access MVP
 
A

Anthony

Hi Gerald

I have made some progress, in that I discovered I was using the control
source instead of the combo box name in my lines of code. So the program now
does not halt when it reaches these lines of code. However, the second combo
box contains nothing in it after update, regardless of whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form"). I can't see the
problem.

Thanks in advance for any suggestions
Anthony
 
G

Gerald Stanley

Anthony

I am puzzled by the line 'Cancel = True'. Why have you got
it there?

Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I have made some progress, in that I discovered I was using the control
source instead of the combo box name in my lines of code. So the program now
does not halt when it reaches these lines of code. However, the second combo
box contains nothing in it after update, regardless of whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form"). I can't see the
problem.

Thanks in advance for any suggestions
Anthony

Gerald Stanley said:
Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD


.
 
A

Anthony

Hi Gerald

I really don't know why I use "Cancel=True". I discovered this after a
message box command in an example piece of code and just assumed it was
necessary. I will see what happens when I remove it.

I tried as Michel Walsh suggested and inserted the following lines of
code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

....into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function (as descibed in my previous post) that
interfere with the second combo box updating correctly. I will try running
it without the "Cancel=True"; any other suggestions?

Anthony

Gerald Stanley said:
Anthony

I am puzzled by the line 'Cancel = True'. Why have you got
it there?

Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I have made some progress, in that I discovered I was using the control
source instead of the combo box name in my lines of code. So the program now
does not halt when it reaches these lines of code. However, the second combo
box contains nothing in it after update, regardless of whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form"). I can't see the
problem.

Thanks in advance for any suggestions
Anthony

Gerald Stanley said:
Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Sorry for the confusion, Gerald.

I did as you suggested and set the RowSourceType to "Value
List" in design
view and removed the offending line of code.

Now I am having problems with the second line of code:
Me!OperationSubType.RowSource = "A;B;C".

I think it may be "RowSource" and "RowSourceType" that are
causing the
problems. Perhaps there is some option or object
library(?) that I should
select to make these commands work????

Anthony

Anthony

I did not suggest that you could create different value
lists in the Design View - I said that you should set the
RowSourceType to 'Value List' in the Design View so that
you would not need the line of code that is giving you the
problem.

Regards
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

Thanks for your response.

1. How would I go about creating different value lists in
design view?
Wouldn't this limit the value list to only one set of
values?

2. I tried your suggestion, but I am still having problems
with the run time
error, so I can't tell yet whether your suggestion works.
Any clues as to
how I can eliminate the error "Run-time error 438: Object
doesn't support
this property or method"?

Thanks Gerald
Anthony
Your code should work as it is but here are a couple of
observations.
1. If the rowSourceType of comboBox operationSubType is
always 'Value List', why not set it as such in the Design
View then you would not have to set it in code.
2. If you RowSource code was trying to show three
items in
the list, it should have read
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi

I have a combo box called OperationSubType, which
contains
a list of values
that I would like to change depending on the value
selected in another combo
box called OperationType. I have looked at various other
posts and web sites
that assume the row source type is a table/query, and
tried to adapt these
to my combo boxes, which have value lists as their row
source types rather
than tables/queries.

I have included the following two lines in the
AfterUpdate
section of the
OperationType combo box:

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A" & "B" & "C"

However, when this code is activated, the following
error
occurs as a result
of the first line of code:

"Run-time error 438: Object doesn't support this
property
or method".

Am I able to use a value list in this situation or do I
have to create a new
table to hold the values for "OperationSubType"?

Thanks in advance
Anthony


.



.



.


.
 
A

Anthony

Hi Michel

I tried as as you suggested and inserted the following lines of code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

....into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function that interfere with the second combo box
updating correctly.

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form").

Anthony
 
G

Gerald Stanley

Anthony

It does sometimes happen with Access where forms that have
been subjected to a number of coding changes do act
strangely. I would concur with Michel's advice i.e. start
with a new form and take it form there. At least you know
the code that we have suggested does work.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I really don't know why I use "Cancel=True". I discovered this after a
message box command in an example piece of code and just assumed it was
necessary. I will see what happens when I remove it.

I tried as Michel Walsh suggested and inserted the following lines of
code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

....into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function (as descibed in my previous post) that
interfere with the second combo box updating correctly. I will try running
it without the "Cancel=True"; any other suggestions?

Anthony

Gerald Stanley said:
Anthony

I am puzzled by the line 'Cancel = True'. Why have you got
it there?

Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I have made some progress, in that I discovered I was using the control
source instead of the combo box name in my lines of code. So the program now
does not halt when it reaches these lines of code. However, the second combo
box contains nothing in it after update, regardless of whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form"). I can't see the
problem.

Thanks in advance for any suggestions
Anthony

Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Sorry for the confusion, Gerald.

I did as you suggested and set the RowSourceType to "Value
List" in design
view and removed the offending line of code.

Now I am having problems with the second line of code:
Me!OperationSubType.RowSource = "A;B;C".

I think it may be "RowSource" and "RowSourceType" that are
causing the
problems. Perhaps there is some option or object
library(?) that I should
select to make these commands work????

Anthony

Anthony

I did not suggest that you could create different value
lists in the Design View - I said that you should set the
RowSourceType to 'Value List' in the Design View so that
you would not need the line of code that is giving you the
problem.

Regards
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

Thanks for your response.

1. How would I go about creating different value lists in
design view?
Wouldn't this limit the value list to only one set of
values?

2. I tried your suggestion, but I am still having problems
with the run time
error, so I can't tell yet whether your suggestion works.
Any clues as to
how I can eliminate the error "Run-time error 438: Object
doesn't support
this property or method"?

Thanks Gerald
Anthony
Your code should work as it is but here are a couple of
observations.
1. If the rowSourceType of comboBox operationSubType is
always 'Value List', why not set it as such in the Design
View then you would not have to set it in code.
2. If you RowSource code was trying to show three
items in
the list, it should have read
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi

I have a combo box called OperationSubType, which
contains
a list of values
that I would like to change depending on the value
selected in another combo
box called OperationType. I have looked at various other
posts and web sites
that assume the row source type is a table/query, and
tried to adapt these
to my combo boxes, which have value lists as their row
source types rather
than tables/queries.

I have included the following two lines in the
AfterUpdate
section of the
OperationType combo box:

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A" & "B" & "C"

However, when this code is activated, the following
error
occurs as a result
of the first line of code:

"Run-time error 438: Object doesn't support this
property
or method".

Am I able to use a value list in this situation or do I
have to create a new
table to hold the values for "OperationSubType"?

Thanks in advance
Anthony


.



.



.



.


.
 
A

Anthony

Will do. Thanks for all of your help Gerald.

Anthony
Gerald Stanley said:
Anthony

It does sometimes happen with Access where forms that have
been subjected to a number of coding changes do act
strangely. I would concur with Michel's advice i.e. start
with a new form and take it form there. At least you know
the code that we have suggested does work.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I really don't know why I use "Cancel=True". I discovered this after a
message box command in an example piece of code and just assumed it was
necessary. I will see what happens when I remove it.

I tried as Michel Walsh suggested and inserted the following lines of
code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

....into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function (as descibed in my previous post) that
interfere with the second combo box updating correctly. I will try running
it without the "Cancel=True"; any other suggestions?

Anthony

Gerald Stanley said:
Anthony

I am puzzled by the line 'Cancel = True'. Why have you got
it there?

Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I have made some progress, in that I discovered I was
using the control
source instead of the combo box name in my lines of code.
So the program now
does not halt when it reaches these lines of code.
However, the second combo
box contains nothing in it after update, regardless of
whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my
after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and
plate") Then
MsgBox "For this operation, you must enter
more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if
it is "Dynamic
hipscrew and plate", then it should update the value list
then run the
macro, which opens another form that allows the user to
enter more info
specific to this type of operation and which varies for
each type of
operation. As far as the user is concerned, they enter the
value in
OperationType1, and once they try another mouse click (for
a command button
or down arrow on a combo box) a message box appears and
they click ok. Then
the other form opens and they enter more data and press
enter. Then they are
returned to the original form (ie. "Operation Form"). I
can't see the
problem.

Thanks in advance for any suggestions
Anthony

Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Sorry for the confusion, Gerald.

I did as you suggested and set the RowSourceType to "Value
List" in design
view and removed the offending line of code.

Now I am having problems with the second line of code:
Me!OperationSubType.RowSource = "A;B;C".

I think it may be "RowSource" and "RowSourceType" that are
causing the
problems. Perhaps there is some option or object
library(?) that I should
select to make these commands work????

Anthony

Anthony

I did not suggest that you could create different value
lists in the Design View - I said that you should set the
RowSourceType to 'Value List' in the Design View so that
you would not need the line of code that is giving
you the
problem.

Regards
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

Thanks for your response.

1. How would I go about creating different value
lists in
design view?
Wouldn't this limit the value list to only one set of
values?

2. I tried your suggestion, but I am still having
problems
with the run time
error, so I can't tell yet whether your suggestion
works.
Any clues as to
how I can eliminate the error "Run-time error 438:
Object
doesn't support
this property or method"?

Thanks Gerald
Anthony
message
Your code should work as it is but here are a
couple of
observations.
1. If the rowSourceType of comboBox
operationSubType is
always 'Value List', why not set it as such in the
Design
View then you would not have to set it in code.
2. If you RowSource code was trying to show three
items in
the list, it should have read
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi

I have a combo box called OperationSubType, which
contains
a list of values
that I would like to change depending on the value
selected in another combo
box called OperationType. I have looked at
various other
posts and web sites
that assume the row source type is a table/query, and
tried to adapt these
to my combo boxes, which have value lists as
their row
source types rather
than tables/queries.

I have included the following two lines in the
AfterUpdate
section of the
OperationType combo box:

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A" & "B" & "C"

However, when this code is activated, the following
error
occurs as a result
of the first line of code:

"Run-time error 438: Object doesn't support this
property
or method".

Am I able to use a value list in this situation
or do I
have to create a new
table to hold the values for "OperationSubType"?

Thanks in advance
Anthony


.



.



.



.


.
 
A

Anthony

Just letting you know that I found a solution to my problem. I placed the
two lines of code, that is:
Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"
in amongst the code for a command button in another form. This form opens
immediately when the value for "OperationType" is entered/changed. A
different form opens depending on the value selected in this combo box. The
user enters details in the relevant form and presses a command button to
close this form and return to the original form. The value list updates
(successfully!) at this point.

Thanks again for helping me identify the actual problem.
Anthony




Gerald Stanley said:
Anthony

It does sometimes happen with Access where forms that have
been subjected to a number of coding changes do act
strangely. I would concur with Michel's advice i.e. start
with a new form and take it form there. At least you know
the code that we have suggested does work.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I really don't know why I use "Cancel=True". I discovered this after a
message box command in an example piece of code and just assumed it was
necessary. I will see what happens when I remove it.

I tried as Michel Walsh suggested and inserted the following lines of
code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

....into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function (as descibed in my previous post) that
interfere with the second combo box updating correctly. I will try running
it without the "Cancel=True"; any other suggestions?

Anthony

Gerald Stanley said:
Anthony

I am puzzled by the line 'Cancel = True'. Why have you got
it there?

Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

I have made some progress, in that I discovered I was
using the control
source instead of the combo box name in my lines of code.
So the program now
does not halt when it reaches these lines of code.
However, the second combo
box contains nothing in it after update, regardless of
whether I use "Me."
or "Me!".

I wonder if the other lines of code (see below) in my
after update function
are preventing the value list from updating:

*************code***************
If ([OperationType1] = "dynamic hipscrew and
plate") Then
MsgBox "For this operation, you must enter
more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if
it is "Dynamic
hipscrew and plate", then it should update the value list
then run the
macro, which opens another form that allows the user to
enter more info
specific to this type of operation and which varies for
each type of
operation. As far as the user is concerned, they enter the
value in
OperationType1, and once they try another mouse click (for
a command button
or down arrow on a combo box) a message box appears and
they click ok. Then
the other form opens and they enter more data and press
enter. Then they are
returned to the original form (ie. "Operation Form"). I
can't see the
problem.

Thanks in advance for any suggestions
Anthony

Try
Me.OperationSubType.RowSource = "A;B;C"
instead of
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Sorry for the confusion, Gerald.

I did as you suggested and set the RowSourceType to "Value
List" in design
view and removed the offending line of code.

Now I am having problems with the second line of code:
Me!OperationSubType.RowSource = "A;B;C".

I think it may be "RowSource" and "RowSourceType" that are
causing the
problems. Perhaps there is some option or object
library(?) that I should
select to make these commands work????

Anthony

Anthony

I did not suggest that you could create different value
lists in the Design View - I said that you should set the
RowSourceType to 'Value List' in the Design View so that
you would not need the line of code that is giving
you the
problem.

Regards
Gerald Stanley MCSD
-----Original Message-----
Hi Gerald

Thanks for your response.

1. How would I go about creating different value
lists in
design view?
Wouldn't this limit the value list to only one set of
values?

2. I tried your suggestion, but I am still having
problems
with the run time
error, so I can't tell yet whether your suggestion
works.
Any clues as to
how I can eliminate the error "Run-time error 438:
Object
doesn't support
this property or method"?

Thanks Gerald
Anthony
message
Your code should work as it is but here are a
couple of
observations.
1. If the rowSourceType of comboBox
operationSubType is
always 'Value List', why not set it as such in the
Design
View then you would not have to set it in code.
2. If you RowSource code was trying to show three
items in
the list, it should have read
Me!OperationSubType.RowSource = "A;B;C"

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
Hi

I have a combo box called OperationSubType, which
contains
a list of values
that I would like to change depending on the value
selected in another combo
box called OperationType. I have looked at
various other
posts and web sites
that assume the row source type is a table/query, and
tried to adapt these
to my combo boxes, which have value lists as
their row
source types rather
than tables/queries.

I have included the following two lines in the
AfterUpdate
section of the
OperationType combo box:

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A" & "B" & "C"

However, when this code is activated, the following
error
occurs as a result
of the first line of code:

"Run-time error 438: Object doesn't support this
property
or method".

Am I able to use a value list in this situation
or do I
have to create a new
table to hold the values for "OperationSubType"?

Thanks in advance
Anthony


.



.



.



.


.
 
A

Anthony

Just letting you know that I found a solution to my problem. I placed the
two lines of code, that is:
Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"
in amongst the code for a command button in another form. This form opens
immediately when the value for "OperationType" is entered/changed. A
different form opens depending on the value selected in this combo box. The
user enters details in the relevant form and presses a command button to
close this form and return to the original form. The value list updates
(successfully!) at this point.

Thanks again for helping me identify the actual problem.
Anthony
Anthony said:
Hi Michel

I tried as as you suggested and inserted the following lines of code...

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

...into the after update section of a completely new application and found
that it does actually work. I then ran a repair of the original file and
there were no changes as a result. This makes me wonder if it is the other
things in the after update function that interfere with the second combo box
updating correctly.

*************code***************
If ([OperationType1] = "dynamic hipscrew and plate") Then
MsgBox "For this operation, you must enter more details in
another form.", vbExclamation
Cancel = True

Me!OperationSubType.RowSourceType = "Value List"
Me!OperationSubType.RowSource = "A;B;C"

DoCmd.RunMacro StDocNameX

Else
***********end code**************


So when I choose a value in "OperationType1" combo box, if it is "Dynamic
hipscrew and plate", then it should update the value list then run the
macro, which opens another form that allows the user to enter more info
specific to this type of operation and which varies for each type of
operation. As far as the user is concerned, they enter the value in
OperationType1, and once they try another mouse click (for a command button
or down arrow on a combo box) a message box appears and they click ok. Then
the other form opens and they enter more data and press enter. Then they are
returned to the original form (ie. "Operation Form").

Anthony
Michel Walsh said:
Hi,


Is OperationSubType really a combo box? If so, try on a brand new
application, new from, just that combo box, and a second control that can
get the focus, and the code in the After Update event of the combo box. In
view mode, type something in the combo box, move to the other control,
com
e
back to the combo box, its list should now be made of the three choices, A,
B and C.


If that works in the new application but not in the old, the
technique is right, and so, ***may be*** the old application file is damaged
or corrupted. Try a repair.


Hoping it may help,
Vanderghast, Access MVP


to
how
as
 

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

Top