Re: Still Struggling...
- From: "BruceM" <bamoob@xxxxxxxxxxxxxxxx>
- Date: Fri, 11 Jul 2008 07:45:00 -0400
I can't figure why it isn't sorting, although I have one idea I will address later. Try this:
SELECT [EmpID], [LastName] & ", " & [FirstName] AS LastFirst FROM tblEmployees ORDER BY
[LastName], [FirstName];
This doesn't really address your questions in some ways, but it is an example of how an alias (LastFirst) can be used. You didn't mention column widths, but for a three column colmbo box in which the first column is hidden then would be something like 0";1";1". In my example the column count would be 2 and the column widths 0";1". From what I can tell the rightmost visible column will fill the rest of the space in the combo box. If there is one visible column it will be the width of the combo box unless its width is greater than the combo box width. If the combo box is 2.5" wide and the visible columns are 1";1" the rightmost column will actually be 1.5". If the combo box is 1.5" wide and the visible columns are 1";1" the rightmost column will hang over the edge of the combo box when you click the down arrow.
Anyhow, back to the combo box. In this case it should be unbound. You aren't trying to store the value, but rather to go to the selected record. For this the combo box needs an After Update event something like this (cboEmployee is the name of the combo box):
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[EmployeeID] = " & Me.cboEmployee
Me.Bookmark = rs.Bookmark
You could also do it this way:
Me.RecordsetClone.FindFirst "[EmployeeID] = " & Me.cboEmployee
Me.Bookmark = Me.RecordsetClone.Bookmark
The difference is that in the first case rs is used as a sort of abbreviation for Me.RecordsetClone. Thereafter you use rs in place of Me.RecordsetClone. Dim rs as Object declares rs as an object variable. I don't want to get too deeply into this, but when you hear about variable declaration and use, this is one example.
Back to the sorting in the combo box. Open the SQL in Design View and be sure it is what it should be. Unless there is a lookup field in the table, it should work. To see if there is a lookup field, open the table and see if any of the fields have a drop-down arrow. If they do, report back about it. It needs to be fixed.
Assuming you get the combo box to work as intended, just what action are you performing when you print the record? Best choice would be to create a report (it can be very simple if you like), and to print the report. It is an easy enough matter to limit printing the report to a single selected record.
"Aria via AccessMonster.com" <u44643@uwe> wrote in message news:86f39d41551ee@xxxxxx
Apparently there are problems in the Microsoft forum. I hate to break the
thread (sorry Bruce) but I was wondering if you could help me with something?
Currently, I'm working with frmEmployees. I want the form to be user-friendly.
I know there are going to be issues there. There is an example of what I want
to do in my book and I followed what they said to do, but of course it isn't
working for me. In frmEmployees I added a combo box. It's unbound; maybe it
should be bound. I did try that but it again only showed the last name. What
I'm trying to do is create a drop-down list of employee last name, first name.
When the user clicks on the name, it goes to that employee record. I added a
print record button (I don't know if it works because currently, I'm stuck on
this). I see the names in the drop-down but it isn't going to that record and
when I click on the name it then only shows the last name.
This is the SQL statement: SELECT [tblEmployees].[EmpID], [tblEmployees].
[LastName], [tblEmployees].[FirstName] FROM tblEmployees ORDER BY
[tblEmployees].[LastName], [tblEmployees].[FirstName];
The Record Source is tblEmployees. I tried to put Last name in as the control
source but Access didn't like that so I took it out. The Row Source Type is
table/query. Column count = 3
Bound Column = 1
I'm sure we've already discussed this but I not catching it. I've looked at
the query. It looks like what I want. I've also looked at it in data***
view. The names are there but it did not sort ascending like I asked. What
mistakes have I made and how do I fix it?
Beetle284 wrote:You may need to refresh my memory a bit here. You had m:m relationships
for Employees to Titles and Employees to Classifications, so you have
junction
tables for each of them, is that correct?
[quoted text clipped - 15 lines]I was talking specifically about tables, not forms.
gonna
start :- )
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200807/1
.
- Follow-Ups:
- Re: Still Struggling...
- From: Aria
- Re: Still Struggling...
- References:
- Re: Still Struggling...
- From: Aria
- Re: Still Struggling...
- From: Beetle284 via AccessMonster.com
- Re: Still Struggling...
- From: Aria via AccessMonster.com
- Re: Still Struggling...
- From: Beetle284 via AccessMonster.com
- Re: Still Struggling...
- From: Aria via AccessMonster.com
- Re: Still Struggling...
- From: BruceM
- Re: Still Struggling...
- From: Aria via AccessMonster.com
- Re: Still Struggling...
- Prev by Date: Re: Have Fields Automatically Calculate
- Next by Date: Re: Typing info into text box
- Previous by thread: Re: Still Struggling...
- Next by thread: Re: Still Struggling...
- Index(es):