Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Sounds like the dB is not normalised if you need to create tables each month?, anyway surround the ADHD with a single quote ' as it is text

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    I'd probably have a set of empty tables and copy them each month?

  3. #18
    pnpez is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    18
    still getting syntax error on update statement:
    CurrentDb.Execute "UPDATE ADHD" & "Set DrugType2 = 'ADHD';"

  4. #19
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Try this:
    Code:
    CurrentDb.Execute "UPDATE [ADHD] Set [DrugType2] = 'ADHD';"

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    Why the concatenation when there is no need?😔
    You need spaces between the words?
    Other way, put it all into a string, debug print that to see what comes out, then execute that?

  6. #21
    pnpez is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    18
    the identifier [ADHD] could not be found

  7. #22
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Can you please post the entire code (using the code tags # in the forum)?
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #23
    pnpez is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    18
    Vlad, This is all there is (not sure how to use code tags num) :

    Sub alter2()

    'CurrentDb.Execute "ALTER TABLE ADHD ADD COLUMN DrugType2 TEXT(255);"


    'CurrentDb.Execute "Update ADHD Set DrugType2 = 'ADHD';"

    End Sub

  9. #24
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Can you try this, I think you need to refresh the tabledef:
    Code:
    Sub alter2()
    CurrentDb.Execute "ALTER TABLE ADHD ADD COLUMN DrugType2 TEXT(255);"
    CurrentDb.Tabledefs.Refresh
    CurrentDb.Execute "Update ADHD Set DrugType2 = 'ADHD';"
    End Sub
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #25
    pnpez is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    18
    Solved!!!!!!!!!!!
    Thanks again guys.

  11. #26
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    I'll just re-itereate what others have said here, if you are adding a column every month you aren't using this as a database.
    This is spreadsheet thinking.

    Have a read up on Normalisation.
    Preferably before you come back asking why your queries ae so difficult to get working.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  12. #27
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,041
    If your friend needs to add columns to a table on a regular base, it seems to me there is something wrong with his database design.

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

Similar Threads

  1. Access 2016 not enough memory error
    By Mediaweb in forum Access
    Replies: 3
    Last Post: 09-11-2020, 04:40 AM
  2. Replies: 3
    Last Post: 08-08-2018, 02:48 PM
  3. Error trying to write a record - MS Access 2016
    By Dave Lambert in forum Access
    Replies: 5
    Last Post: 07-18-2018, 07:16 AM
  4. Error Messages On Subforms, Access 2016
    By roxdrob in forum Forms
    Replies: 19
    Last Post: 10-07-2017, 11:40 PM
  5. ODBC connection for Access 2016 - results in error
    By Ashish_Panchal in forum Access
    Replies: 3
    Last Post: 11-25-2016, 01:35 AM

Tags for this Thread

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