Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 41
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    A row source like:



    SELECT LastName & ", " & FirstName As FullName
    FROM TableName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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:
    
    
    Code:
    SELECT LastName & ", " & FirstName As FullName
     FROM TableName
    This sure seems calculated.

    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

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    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.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    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).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The SQL the wizard created:

    SELECT tblPersonnel.PersonnelID, tblPersonnel.FullName, tblPersonnel.emailaddress
    FROM tblPersonnel
    ORDER BY tblPersonnel.[FullName];
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    I tried the SQL statement

    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
    Attached Files Attached Files

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    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.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    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.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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,

  13. #28
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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
    Attached Files Attached Files

  14. #29
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What form? frmEmail doesn't have a combo with that name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #30
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    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

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-29-2016, 08:52 PM
  2. Issues with combo boxes
    By Accu-Grind in forum Forms
    Replies: 8
    Last Post: 05-14-2015, 05:24 PM
  3. Issues with Access 2013 combo box
    By Andys in forum Modules
    Replies: 2
    Last Post: 03-06-2014, 05:28 PM
  4. Combo Box Issues on Form
    By aceoftrades in forum Forms
    Replies: 4
    Last Post: 12-28-2013, 12:47 PM
  5. 3rd Combo Box Cascade Issues
    By GAccess in forum Forms
    Replies: 12
    Last Post: 03-06-2012, 03:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums