Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412

    I added option explicit, the error below shows now when the form is opened.
    that is because you haven't declared it (the second issue) ie.

    dim DeleteRecords as string

    edit: I strongly recommend you ensure Option Explicit is at the top of all modules, including form modules. Once you have done that from the vba window select debug>compile. This will highly most potential problems in your code. If compile is greyed out, it means the code is successfully compiled. It is always worth compiling after making changes and before you execute the code to make sure these problems do not exist. It won't identify issues around data (such as null values, number out of range, etc) but you will have significantly reduced the number of potential issues you might get at runtime.

    You can ensure new modules have Option Explicit added automatically when they are created by selecting Tools>Options and in the editor tab tick the 'require variable declaration' option

  2. #17
    Perfac's Avatar
    Perfac is offline Expert
    Windows 10 Access 2016
    Join Date
    May 2016
    Location
    Centurion Pretoria
    Posts
    618
    Can n Module be set up to delete records in a query?

  3. #18
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    I linked two tables in this query. There are more fields in the tables. Does it make a difference if only two fields show in the query, or should all of them show? I want these two records to be deleted from the table. If I am going to explain it will take up your precious time.
    If the query is updateable in general then I don't believe it should matter how many fields you use if you perhaps want to make an edit or delete a record(s).

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

Similar Threads

  1. Replies: 15
    Last Post: 07-02-2018, 09:40 AM
  2. I've found duplicates but how do I delete?
    By rocktap in forum Queries
    Replies: 6
    Last Post: 04-20-2015, 07:08 PM
  3. Delete based on compare
    By hdawn in forum Queries
    Replies: 3
    Last Post: 03-28-2014, 12:09 PM
  4. Replies: 12
    Last Post: 04-25-2013, 01:32 PM
  5. Replies: 1
    Last Post: 04-29-2010, 05:22 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