A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combobox Question



 
 
Thread Tools Display Modes
  #1  
Old January 19th, 2009, 11:16 PM posted to microsoft.public.access.gettingstarted
Aria
external usenet poster
 
Posts: 150
Default Combobox Question


Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.
  #2  
Old January 19th, 2009, 11:39 PM posted to microsoft.public.access.gettingstarted
troy23
external usenet poster
 
Posts: 55
Default Combobox Question

Can you not sort by last name in the query behind the combo box?

For FREE Access ebook and videos click here
http://access-databases.com/ebook

On Jan 19, 11:16*pm, Aria wrote:
Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.


  #3  
Old January 19th, 2009, 11:44 PM posted to microsoft.public.access.gettingstarted
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default Combobox Question

If the SQL statement that you posted is the query that is being used as the
cboFindAnEmployee combobox's RowSource query, then the combobox should be
behaving as you wish.

If you have something else for the combobox's RowSource property, post that
for us to assist you.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"Aria" wrote in message
...

Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When
I
first created the combobox and tested it to see if it was working, I used
my
name for the first record and then others to test it. Quite frankly, I'm
sick
of seeing my name in the combobox since I'm towards the end of the
alphabet.
I would like whomever has the last name that starts the "A"s to show
first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.



  #4  
Old January 19th, 2009, 11:57 PM posted to microsoft.public.access.gettingstarted
Aria
external usenet poster
 
Posts: 150
Default Combobox Question

Thanks for responding. I believe the SQL statement indicates that it *is*
sorted by the last name. What I am looking to see is the name that begins the
alpha list in the combobox. I hope that makes sense. For example, the first
name in my combobox has a last name that starts with "Ab". I would *like* to
see this name first, intead of "W" (which begins my last name). If I then
have to input a last name that begins with "Aa" then *that* name is
automatically shown in the combo. Any suggestions?
--
Aria W.


"troy23" wrote:

Can you not sort by last name in the query behind the combo box?

For FREE Access ebook and videos click here
http://access-databases.com/ebook

On Jan 19, 11:16 pm, Aria wrote:
Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.



  #5  
Old January 20th, 2009, 12:03 AM posted to microsoft.public.access.gettingstarted
Beetle
external usenet poster
 
Posts: 1,254
Default Combobox Question

That's happening because of the code in the forms
Current event that keeps the search box in synch
with the current record. Your name is the first record
in the table, so when the form opens the Current event
fires and moves the combo box to your name. If you don't
want that to happen, open the code window for the
Current event and comment out this line;

Me.cboFindAnEmployee = Me.EmpID

Cheers
--
_________

Sean Bailey


"Aria" wrote:


Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.

  #6  
Old January 20th, 2009, 12:07 AM posted to microsoft.public.access.gettingstarted
Aria
external usenet poster
 
Posts: 150
Default Combobox Question

I'm sorry, I must not be explaining very well.

The RowSource is:
SELECT [tblEmployees].[EmpID], [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees ORDER BY [LastName] & ", " & [FirstName],
[tblEmployees].[LastName], [tblEmployees].[FirstName];

What I see:
In cboFindAnEmployee my name is shown in the box, I believe, because it is
the first record I input. When you click on the drop-down arrow, all
additional names are listed in alphabetical order.

What I would like to see:
Whomever has the first name in the list, their name shown in the box. If I
input another record that falls ahead of that person in the alphabet, *their
name is shown in the box first.

Sorry for the confusion, I hope that explains a little better.
--
Aria W.


"Ken Snell (MVP)" wrote:

If the SQL statement that you posted is the query that is being used as the
cboFindAnEmployee combobox's RowSource query, then the combobox should be
behaving as you wish.

If you have something else for the combobox's RowSource property, post that
for us to assist you.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"Aria" wrote in message
...

Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When
I
first created the combobox and tested it to see if it was working, I used
my
name for the first record and then others to test it. Quite frankly, I'm
sick
of seeing my name in the combobox since I'm towards the end of the
alphabet.
I would like whomever has the last name that starts the "A"s to show
first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.




  #7  
Old January 20th, 2009, 12:26 AM posted to microsoft.public.access.gettingstarted
Aria
external usenet poster
 
Posts: 150
Default Combobox Question

Hi,
OK, I tried it and it's not quite what I was looking for but I do see what
everyone is trying to tell me now. After following your suggestion, my name
is removed and it doesn't show any name. So the answer would be I either keep
the combo in synch with the current (1st) record or leave the space blank,
correct? I can't show record #79 (for instance) just because the last name
happens to come first in the alphabet.
--
Aria W.


"Beetle" wrote:

That's happening because of the code in the forms
Current event that keeps the search box in synch
with the current record. Your name is the first record
in the table, so when the form opens the Current event
fires and moves the combo box to your name. If you don't
want that to happen, open the code window for the
Current event and comment out this line;

Me.cboFindAnEmployee = Me.EmpID

Cheers
--
_________

Sean Bailey


"Aria" wrote:


Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.

  #8  
Old January 20th, 2009, 01:53 AM posted to microsoft.public.access.gettingstarted
Beetle
external usenet poster
 
Posts: 1,254
Default Combobox Question

You can use Me.cboFindAnEmployee = Me.cboFindAnEmployee.ItemData(0)
to get it to display the first name in the sort order. If you use this in
your forms
Open event it will move to the first name when the form opens, but after
that it will
display whichever name was selected last (as long as it isn't requeried by
some
other method). You could also use the Current event, but then it will move
back
to the first name every time you change records (which you may not want).
--
_________

Sean Bailey


"Aria" wrote:

Hi,
OK, I tried it and it's not quite what I was looking for but I do see what
everyone is trying to tell me now. After following your suggestion, my name
is removed and it doesn't show any name. So the answer would be I either keep
the combo in synch with the current (1st) record or leave the space blank,
correct? I can't show record #79 (for instance) just because the last name
happens to come first in the alphabet.
--
Aria W.


"Beetle" wrote:

That's happening because of the code in the forms
Current event that keeps the search box in synch
with the current record. Your name is the first record
in the table, so when the form opens the Current event
fires and moves the combo box to your name. If you don't
want that to happen, open the code window for the
Current event and comment out this line;

Me.cboFindAnEmployee = Me.EmpID

Cheers
--
_________

Sean Bailey


"Aria" wrote:


Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.

  #9  
Old January 20th, 2009, 06:14 AM posted to microsoft.public.access.gettingstarted
Aria
external usenet poster
 
Posts: 150
Default Combobox Question

Thank you! That's exactly what I wanted.
--
Aria W.


"Beetle" wrote:

You can use Me.cboFindAnEmployee = Me.cboFindAnEmployee.ItemData(0)
to get it to display the first name in the sort order. If you use this in
your forms
Open event it will move to the first name when the form opens, but after
that it will
display whichever name was selected last (as long as it isn't requeried by
some
other method). You could also use the Current event, but then it will move
back
to the first name every time you change records (which you may not want).
--
_________

Sean Bailey


"Aria" wrote:

Hi,
OK, I tried it and it's not quite what I was looking for but I do see what
everyone is trying to tell me now. After following your suggestion, my name
is removed and it doesn't show any name. So the answer would be I either keep
the combo in synch with the current (1st) record or leave the space blank,
correct? I can't show record #79 (for instance) just because the last name
happens to come first in the alphabet.
--
Aria W.


"Beetle" wrote:

That's happening because of the code in the forms
Current event that keeps the search box in synch
with the current record. Your name is the first record
in the table, so when the form opens the Current event
fires and moves the combo box to your name. If you don't
want that to happen, open the code window for the
Current event and comment out this line;

Me.cboFindAnEmployee = Me.EmpID

Cheers
--
_________

Sean Bailey


"Aria" wrote:


Hello,
Is there any way to have a combobox (cboFindAnEmployee) show the names in
alphabetical order no matter which order the records were entered? I mean
when you first open your database and not based on the first record? When I
first created the combobox and tested it to see if it was working, I used my
name for the first record and then others to test it. Quite frankly, I'm sick
of seeing my name in the combobox since I'm towards the end of the alphabet.
I would like whomever has the last name that starts the "A"s to show first. I
know it's nitpicky but what can I say...

I don't know if you need this info but here it it:
SQL
***
SELECT tblEmployees.EmpID, [LastName] & ", " & [FirstName] AS LastFirst
FROM tblEmployees
ORDER BY [LastName] & ", " & [FirstName], tblEmployees.LastName,
tblEmployees.FirstName;

Thank you for any suggestions.

--
Aria W.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.