combo box column value in query

F

Fuzuy

Hi, All:

I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third column
was used for filter another table to be displyed in a listing-box.

for the combo box its first column value in a query grid criteria
is :

[Forms]![itsfrm]![cbocomb] it works fine,

however, the value of third combo box does not come up as it supposed
to be

for the combo box its third column value,:


[Forms]![itsfrm]![cbocomb]![column](2)

it does not return value as shown in the combo box listing.

Am I doing something not right, I can't see it. Your help is greatly
appreciated. I am using Access 2003.

Thanks.
 
W

Wolfgang Kais

Hello "Fuzuy".

Fuzuy said:
Hi, All:

I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displyed in a
listing-box.

for the combo box its first column value in a query grid criteria
is :

[Forms]![itsfrm]![cbocomb] it works fine,

however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:

[Forms]![itsfrm]![cbocomb]![column](2)
[...]

You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:
Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function

The use fGetComboColumn(2) in your query.
 
F

Fuzuy

Hello "Fuzuy".





Fuzuy said:
I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displyed in a
listing-box.
for the combo box its first column value in a query grid criteria
is :
[Forms]![itsfrm]![cbocomb] it works fine,
however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:
[Forms]![itsfrm]![cbocomb]![column](2)
[...]

You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:
Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function

The use fGetComboColumn(2) in your query.

--
Regards,
Wolfgang- Hide quoted text -

- Show quoted text -

Hi, Wolfgang :

Thanks, I tried, but afraid that I did not do right so it won't show
still.

My combo box resides in a form, so I tried to pass that third column
value as a criteria for a row source for a listing box and try to
filter a table to be a list using that combo colum value.

this is what I did:

1). In a FORM that list box resides, I create a text box called text8
I copies the function you provided to that form, and at event of Form
Load, then assigned like:

me. text8= fGetComboColumn(2)
and use [Forms]![itsform]![text8] as criteria in query of row source,
but did not work out.

any further suggesstions??

Thanks!
 
G

Guest

The method I generally use is to create a hidden text box with a control
source like:
=[cbocomb]![column](2)
You can then reference this new text box in your query criteria. You might
also be able to use:
=Eval([Forms]![itsfrm]![cbocomb]![column](2))
 
J

John Spencer

Make your life simpler, set the control source of text8 to

=cboComb.Column(2)

Now you don't even need the function.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Fuzuy said:
Hello "Fuzuy".





Fuzuy said:
I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displyed in a
listing-box.
for the combo box its first column value in a query grid criteria
is :
[Forms]![itsfrm]![cbocomb] it works fine,
however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:
[Forms]![itsfrm]![cbocomb]![column](2)
[...]

You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:
Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function

The use fGetComboColumn(2) in your query.

--
Regards,
Wolfgang- Hide quoted text -

- Show quoted text -

Hi, Wolfgang :

Thanks, I tried, but afraid that I did not do right so it won't show
still.

My combo box resides in a form, so I tried to pass that third column
value as a criteria for a row source for a listing box and try to
filter a table to be a list using that combo colum value.

this is what I did:

1). In a FORM that list box resides, I create a text box called text8
I copies the function you provided to that form, and at event of Form
Load, then assigned like:

me. text8= fGetComboColumn(2)
and use [Forms]![itsform]![text8] as criteria in query of row source,
but did not work out.

any further suggesstions??

Thanks!
 
W

Wolfgang Kais

Hello "Fuzuy".

Fuzuy said:
Hi, All:

I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displayed in a
listing-box.

for the combo box its first column value in a query grid criteria
is :

[Forms]![itsfrm]![cbocomb] it works fine,

however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:

[Forms]![itsfrm]![cbocomb]![column](2)
[...]
You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:

Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function

Then use fGetComboColumn(2) in your query.

Thanks, I tried, but afraid that I did not do right so it won't
show still.

My combo box resides in a form, so I tried to pass that third
column value as a criteria for a row source for a listing box and
try to filter a table to be a list using that combo colum value.

this is what I did:

1). In a FORM that list box resides, I create a text box called
text8 I copies the function you provided to that form, and at event
of Form Load, then assigned like:

Me.text8 = fGetComboColumn(2)
and use [Forms]![itsform]![text8] as criteria in query of row source,
but did not work out.

any further suggesstions??

As John and Duane suggested, you can create a textbox that holds the
value and use that in your query. But I think that the problem is that
when you select a value in the combo box, the list should be updated.
Therefore, in the AfterUpdate event of the combo box, create an event
procedure that executed the Requery method of the listbox.
 
F

Fuzuy

Hello "Fuzuy".





Fuzuy said:
Hi, All:
I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displayed in a
listing-box.
for the combo box its first column value in a query grid criteria
is :
[Forms]![itsfrm]![cbocomb] it works fine,
however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:
[Forms]![itsfrm]![cbocomb]![column](2)
[...]
You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:
Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function
Then use fGetComboColumn(2) in your query.
Thanks, I tried, but afraid that I did not do right so it won't
show still.
My combo box resides in a form, so I tried to pass that third
column value as a criteria for a row source for a listing box and
try to filter a table to be a list using that combo colum value.
this is what I did:
1). In a FORM that list box resides, I create a text box called
text8 I copies the function you provided to that form, and at event
of Form Load, then assigned like:
Me.text8 = fGetComboColumn(2)
and use [Forms]![itsform]![text8] as criteria in query of row source,
but did not work out.
any further suggesstions??

As John and Duane suggested, you can create a textbox that holds the
value and use that in your query. But I think that the problem is that
when you select a value in the combo box, the list should be updated.
Therefore, in the AfterUpdate event of the combo box, create an event
procedure that executed the Requery method of the listbox.

--
Regards,
Wolfgang- Hide quoted text -

- Show quoted text -

Hi, All:

Thank you for the information provided. I remembered the provided
solutions work for ACCESS 97 and ACCESS 2000, but it seems not working
for ACCESS 2003.
I ccould not make it works, would anyone confirm or agree ?

Thanks
 
F

Fuzuy

Hello "Fuzuy".
Fuzuy said:
Hi, All:
I have a combo box displays four columns of information, the first
column was used in a query to filetring a table, then the third
column was used for filter another table to be displayed in a
listing-box.
for the combo box its first column value in a query grid criteria
is :
[Forms]![itsfrm]![cbocomb] it works fine,
however, the value of third combo box does not come up as it
supposed to be. For the combo box its third column value:
[Forms]![itsfrm]![cbocomb]![column](2)
[...]
You can't access the value like this in a query, you will have to
use a VBA function in a standard module for this:
Function fGetComboColumn(idCol as integer)
fGetComboColumn = Forms!itsfrm!cbocomb.column(idCol)
End Function
Then use fGetComboColumn(2) in your query.
Thanks, I tried, but afraid that I did not do right so it won't
show still.
My combo box resides in a form, so I tried to pass that third
column value as a criteria for a row source for a listing box and
try to filter a table to be a list using that combo colum value.
this is what I did:
1). In a FORM that list box resides, I create a text box called
text8 I copies the function you provided to that form, and at event
of Form Load, then assigned like:
Me.text8 = fGetComboColumn(2)
and use [Forms]![itsform]![text8] as criteria in query of row source,
but did not work out.
any further suggesstions??
As John and Duane suggested, you can create a textbox that holds the
value and use that in your query. But I think that the problem is that
when you select a value in the combo box, the list should be updated.
Therefore, in the AfterUpdate event of the combo box, create an event
procedure that executed the Requery method of the listbox.
- Show quoted text -

Hi, All:

Thank you for the information provided. I remembered the provided
solutions work for ACCESS 97 and ACCESS 2000, but it seems not working
for ACCESS 2003.
I ccould not make it works, would anyone confirm or agree ?

Thanks- Hide quoted text -

- Show quoted text -

Please disregard the message I posted previously, I created a new FORM
to start with it, it works, something was going on that old FORM .

Thanks again
 

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