Results 1 to 5 of 5
  1. #1
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138

    Make first letter in every table uppercae

    I have this code in my query to update every first letter in table to upercase, it is working.
    Code:
    UPDATE Blokkies 
    SET 
    blokkies.Word = UCase(Mid(Trim([Word]),1,1)) & 
    Mid(Trim([Word]),2), 
    blokkies.home = UCase(Mid(Trim([home]),1,1)) & 
    Mid(Trim([home]),2);
    I have tried to 2 two of them, but it gives me error "Character found after end of SQL statement"


    I know it could be this ."Mid(Trim([home]),2);"

    Code:
    UPDATE Blokkies 
    SET 
    blokkies.Word = UCase(Mid(Trim([Word]),1,1)) & 
    Mid(Trim([Word]),2), 
    blokkies.home = UCase(Mid(Trim([home]),1,1)) & 
    Mid(Trim([home]),2);
    
    UPDATE Afkortings 
    SET 
    Afkortings.Woord = UCase(Mid(Trim([Woord]),1,1)) & 
    Mid(Trim([Woord]),2), 
    Afkortings.Afkorting = UCase(Mid(Trim([Afkorting]),1,1)) & 
    Mid(Trim([Afkorting]),2);
    Is there a way to do more than one update to diffrent tables, as I have a lot of tables to do this every day.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    Can update only one table in an update action.

    Can't have multiple actions in one SQL.

    Need to automate with macro or VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    June7

    Thank you, will do automate in vb and make a query for each one

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Hendrik,

    This should do what you ask.
    Suggest you
    -make a copy/backup of your database and
    -test this routine on a test database before using with operational database.

    Code:
    ' Procedure Kind: Sub
    ' Procedure Access: Public
    ' Author: Jack
    ' Date: 18-Sep-19
    ' ----------------------------------------------------------------
    Sub doUpper()
    10        On Error GoTo doUpper_Error
              Dim db As DAO.Database
              Dim tdef As DAO.TableDef
    20        Set db = CurrentDb
    30        For Each tdef In db.TableDefs
    40            If Not (tdef.Name Like "Msys*" Or _
                          tdef.Name Like "~*") Then
    50                Debug.Print "old :" & tdef.Name
    60                tdef.Name = UCase(Left(tdef.Name, 1)) & Mid(tdef.Name, 2)
    70                Debug.Print "   new:" & tdef.Name
    80            End If
    90        Next tdef
              
    100       On Error GoTo 0
    110       Exit Sub
    
    doUpper_Error:
    
    120       MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure doUpper, line " & Erl & "."
    
    End Sub

  5. #5
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Thank you Orange

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

Similar Threads

  1. find oldest letter in table
    By megatronixs in forum Queries
    Replies: 7
    Last Post: 07-13-2015, 11:49 AM
  2. Replies: 2
    Last Post: 02-17-2015, 01:01 PM
  3. Replies: 4
    Last Post: 02-09-2014, 01:52 PM
  4. Replies: 4
    Last Post: 09-18-2012, 05:07 AM
  5. Replies: 2
    Last Post: 10-27-2009, 07:09 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