Results 1 to 7 of 7
  1. #1
    ianc is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    4

    Post Problem with selecting Names including ' in a combo box.

    I have a small access 2010 database setup which tracks various values by staff name. I've setup a form for the users which includes a combo box which I use to display the rest of the data on a person when the user searches against the name. The combo box was setup with the wizard by choosing the 'find a record on my form based on the value I selected in my combo box' and points to a text field.


    This works fine as long as the name does not have a ' symbol in it. The name appears in the search box as they type it in but when they select the name it stays on the current record.
    They can select the next record in the list and then use a back button to go the required entry but that seems rather clunky.
    I presume this is something simple to fix but I cannot seem to find the field I need to change.
    Thanks!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Can you post a copy of the db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    ianc is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    4
    do you need the back, front or both ends ?

  4. #4
    ianc is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    4
    I presume you will need the front & back end so have attached both, thanks.
    Attached Files Attached Files

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Your problem is caused by the single apostrophe (') that is in the search criteria (Second O'Second 01/01/2000).

    I do not use macros so I can not help with a solution for the correct syntax in your macro.

    However, I do use VBA and I can offer a solution using that. Create an [event procedure] in the After Update event of the combo. Put the following line of code inside that procedure:

    Code:
    DoCmd.SearchForRecord , "", acFirst, "[Full Name] = """ & Screen.ActiveControl & """"
    I have attached a copy of your front end for your perusal
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    ianc is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    4
    Thanks Bob, that has done the trick.

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by ianc View Post
    Thanks Bob, that has done the trick.
    You're welcome. Always glad to help if I can
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Selecting first time entry of a field including details
    By Malcolm Storey in forum Queries
    Replies: 3
    Last Post: 07-11-2020, 12:47 PM
  2. Replies: 2
    Last Post: 11-11-2018, 03:47 AM
  3. Replies: 4
    Last Post: 11-29-2017, 10:01 AM
  4. Replies: 5
    Last Post: 11-30-2014, 08:12 PM
  5. Replies: 1
    Last Post: 07-12-2012, 08:39 AM

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