filtering on using combo box

B

BV2312

Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

Wayne-I-M said:
I assume that you are talking about a form that is based on the table with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



BV2312 said:
Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if pentium
III
is selected

Thanks
 
G

Guest

Hi again

I am bit lost with all this. You asked how to autofill some field and now
you have changed the question.

Your new question seem to be about casscadeing combos. Search on access
help or in this forum as there are many answers regarding this.

However in this case setting the town criteria for the second combo on the
county is a little "back to front" as most users will input the town first
then the county. Also you should be wary of use casscadeing combo for UK
towns/country as there are so many town (names) in different counties and (as
you will know) the post office will mess up where eer then possibly can so an
incorrect address will produce the normal "lost in the post".
As example (from your post)
Ashfield, Dunblane
Ashfield, Romsey
Ashfield, Stowmarket


I am still a little lost aout your questions regarding "where to put the If
Function"


--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



BV2312 said:
Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

Wayne-I-M said:
I assume that you are talking about a form that is based on the table with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



BV2312 said:
Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if pentium
III
is selected

Thanks
 
D

Douglas J. Steele

You need to put code in the AfterUpdate event of the County combo box to
reset the RowSource for the City combo box.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BV2312 said:
Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

Wayne-I-M said:
I assume that you are talking about a form that is based on the table with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and
also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



BV2312 said:
Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if pentium
III
is selected

Thanks
 
B

BV2312

hi doug

thanks for your answer where would i be able to get a sample code of that? i
guess i would have to perform the coding in the form view and not in table
design or is that possible?

Regards

Douglas J. Steele said:
You need to put code in the AfterUpdate event of the County combo box to
reset the RowSource for the City combo box.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BV2312 said:
Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

Wayne-I-M said:
I assume that you are talking about a form that is based on the table
with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the
code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and
also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



:

Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium
I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if pentium
III
is selected

Thanks
 
D

Douglas J. Steele

Take a look at
http://office.microsoft.com/en-ca/access/HA011730581033.aspx?pid=CH063650361033

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BV2312 said:
hi doug

thanks for your answer where would i be able to get a sample code of that?
i guess i would have to perform the coding in the form view and not in
table design or is that possible?

Regards

Douglas J. Steele said:
You need to put code in the AfterUpdate event of the County combo box to
reset the RowSource for the City combo box.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BV2312 said:
Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the
table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

I assume that you are talking about a form that is based on the table
with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the
code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and
also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



:

Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium
I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if
pentium
III
is selected

Thanks
 
B

BV2312

Hi Doug

Cheers for the file!! it helps, but I got one more question what happens if
both fields are in the same table? and how would I be able to do that?

for example I a table called tblComputerDetails

in there I have the following fields:

SerialNo
CPU_type (row source= Intel Celeron; Intel Pentium I; Intel Pentium II)
CPU_speed
Make
Model
RAM
HardDrive

what I would like to do is that by the user selecting 'Intel Pentium I' in
cboCPU_name
I want only the following to show up in cboCPU_speed = 60 66 75* 90 100 120
133 150 166 200

then when the user selects Intel Pentium II in cboCPU_name
I want only the following to show up in cboCPU_speed = 266, 300, 350, 400,
450, 500

I hope this make sense :)S)

Thanks a lot mate

Regards


Douglas J. Steele said:
Take a look at
http://office.microsoft.com/en-ca/access/HA011730581033.aspx?pid=CH063650361033

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


BV2312 said:
hi doug

thanks for your answer where would i be able to get a sample code of
that? i guess i would have to perform the coding in the form view and not
in table design or is that possible?

Regards

Douglas J. Steele said:
You need to put code in the AfterUpdate event of the County combo box to
reset the RowSource for the City combo box.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hi

thanks for your response.

I still do not get where I would put the 'if' function.

Maybe a easy example can help:

I have combo boxes for county and city in a table called address

once I selected 'Nottinghamshire' in combo box county then the combo
box
city would be populated with:

Rushcliffe
Broxtowe
Ashfield
Gedling
Newark and Sherwood
Mansfield
Bassetlaw
Nottingham (Unitary)

or I have selected Derbyshire then city would be populated with:

High Peak
Derbyshire Dales
South Derbyshire
Erewash
Amber Valley
North East Derbyshire
Chesterfield
Bolsover
Derby (Unitary)

and I was wondering if it was possible to be able to do this as the
table
design level in the 'row source' in city combo box.

so if notthinghamshire is select then city has x, y, z and if county =
derbyshire then city = a, b, c

hope this helps in understanding what I would like to do

Regards

BV2312

I assume that you are talking about a form that is based on the table
with
the cpu details, etc

Ensure that all the fields are on your form - after you have run the
code
below all the fields will "autofill"

Create an unbound combo
The row source type for this combo should be Table/Query
The row source should be a query that contains the cpu_name
Set the coloums width to to 2cm
Bound coloum = 1
Call the combo CPUSearch


On the after update event of this combo place this code


Private Sub CPUSearch_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[cpu_name] = " & Str(Me![CPUSearch])
Me.Bookmark = rs.Bookmark
Me.CPUSearch = ""
Me.cpu_name.SetFocus
End Sub


The last 2 lines
Me.CPUSearch = ""
Me.cpu_name.SetFocus
Will re-set the search combo to null ready to take another search and
also
set the focus to the cpu_name field
You can delete these if you don't want/need them

Hope this helps

--
Buon Natale, Happy Chritmas.

Wayne
Manchester, England.
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.



:

Hi people,

I know this must be a common question but i can't seem to find the
answer...

I have a table that has details of processor details:
table name - computer

serial number
cpu_name
cpu_speed
RAM
HD

i want to do the following:

"cpu name" as row source/validation/combo box it can be intel pentium
I,
II,
II
Once i have selected "Intel pentium III" on cup_name
i want cpu_speed to be populated with "500" "550" etc

I would prefer using row source in cpu_speed to show details if
pentium
III
is selected

Thanks
 

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