A row source like:
SELECT LastName & ", " & FirstName As FullName
FROM TableName
A row source like:
SELECT LastName & ", " & FirstName As FullName
FROM TableName
Thanks for your answer. That was what I saw just a I finished writing the post.
How does thus get around the no calculated filed ina combo rule.
Code:This sure seems calculated.Code:SELECT LastName & ", " & FirstName As FullName FROM TableName
Can I do this in he Combo box wizard?
Sorry about eh underlines.
R,
Lou Reed
Last edited by Lou_Reed; 05-01-2017 at 10:10 AM. Reason: correction
I'm not aware of any such rule, though perhaps it applies to calculated fields in tables. I don't think the wizard will let you do that, but you could use the wizard and then modify the SQL.
Thanks that is what I will do. The trouble I had that started this all was putting a calculated filed in my case FullName (a combination of first name and last name) in a combo box. The Fullname calculated field would not go into the field in the combo box. Hence, I had to find a workaround. This works, but it still seems calculated filed.
I see that yours works, but why does not the other way that I explained work?
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed
I don't use calculated fields (I'm normally using SQL Server) but I just used the combo wizard on the database you posted initially, and I was able to choose the FullName field from the table (Access 2010).
I will try it. I could not do it. It simply would not go in. Fullname which is a calculated field simply would not allow its placement in the combo box.
I tried it many times.
Respectfully,
Lou Reed
The SQL the wizard created:
SELECT tblPersonnel.PersonnelID, tblPersonnel.FullName, tblPersonnel.emailaddress
FROM tblPersonnel
ORDER BY tblPersonnel.[FullName];
Here is what I have that I tried to put in based on some examples that I saw online and what you said in an earlier post. It is not working. The error is
"The SELECT statement includes a reserved word or an argument is misspelled or punctuation is wrong"
I just do not see it. It seems logical.
I do not think that I have chosen a reserved word.
I pieced it together from other SQL statements, but it really looked correct.
Open form frmEmail and the first combo box. It seems like something like this could be done by the wizard and at least that would get the SQL syntax correct.
Any help appreciated Thanks in advance.
Respectfully,
Lou Reed
Your SQL is:
SELECT [tblPersonnel].[PersonnelID], [FirstName] & " " & [LastName], AS FullName
FROM tblPersonnel WHERE (tblPersonnel.BranchHead)=No) ORDER BY [FirstName] & " " & [LastName];
which contains 2 errors in red. Delete both.
Okay, I see you point. It just seems that using a MS Access 2010 Wizard would save a lot of syntax trouble.
I suspect that I could have replaced ORDER BY [FirstName] & " " & [LastName], FullName and it would have worked also.
On another note the spacing in the first name and the last name is quite dodgy when I opened the combo box on the form. The first name and the last name were there they were just cut off.
Can that be corrected by moving things around on this : [FirstName] & " " & [LastName]?
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed
On the last sample, the column widths property of the combo isn't set to display the field properly. Looks like the setting is left over from a previous attempt.
Like I said, the wizard on my computer allowed me to use the calculated field in the table.
That takes care of the columns. It is just that now when the combo box is opened, the space set for the names is far too wide. It is much longer than the com box itself.
How do I fix this?
Respectfully,
In the attached file which has a db, in cboFullname, why is there four columns? I have made all but he most important have a width of 0". There are actually only two columns of importantance in the cboFullname the PersonnelID and Fullname. The Fullname is in the second column, column 1. When I get to the line strWho = Me.cboFullName(1), I get the error type mismatch. I am not sure why it is occurring.
I just want the person's full name and then I will worry about the email address later. But it is not working.
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed
What form? frmEmail doesn't have a combo with that name.
In the form frmEmail has a combo with the name cboEmployeeName. I am wondering why it has 4 columns. It seems like a lot of columns for this combo box. The first column 0 is for PersonnelID anf the next two columns 1 and 2 are the first name and the last name of the Employee. But what is the fourth column, column 4 for? I originally called it cboFullname tht was wrong.
It does seem to have any application.
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed
Last edited by Lou_Reed; 05-02-2017 at 06:58 AM. Reason: correction