Results 1 to 11 of 11
  1. #1
    jshaw1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2019
    Posts
    8

    Moving a record from one subform to another

    I'm attempting to build a form to be used as an agenda generator with two subforms in datasheet view: one contains a list of all active projects, and the other is a list of projects to be discussed. What I'd like to have happen is to be able to double-click the project name in the active list and have it move into the to be discussed one. I do not want the record to be deleted from the active list.

    I have an event set for the double-click and an append query to move the data and it works, but it brings up the parameter window when I try to run it. When I manually type the record name in it works fine, but I'd like to avoid having to do this.



    I've written the following code in VBA for the double-click event:

    Code:
    Sub Project_Name_DblClick(Cancel As Integer)
    DoCmd.SetWarnings flase
    DoCmd.OpenQuery "AgendaAppend"
    End Sub
    And the append query is the following SQL:

    Code:
    INSERT INTO AgendaList ( ProjectName, Category )
    SELECT Projects.ProjectName, Projects.Type
    FROM Projects
    WHERE Projects.ProjectName=forms!AgendaListSubform!ProjectName
    ORDER BY Projects.Type;
    Any help would be appreciated!

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    One of the golden rules in Access is that data should never be duplicated.
    So I wouldn't append your data to another table.Instead use a query to view the data in its original table
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    What do you mean by 'active list' and 'to be discussed list'? You have two tables? Why not just 1 table with a field to set record status? Then apply filter to forms.
    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.

  4. #4
    jshaw1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2019
    Posts
    8
    isladogs and June7, thanks for your replies. Allow me to try to clarify some things.

    The active list is based on a query that only displays projects that have been identified as “active”. This active list would need to remain constant from week to week and not have any records removed (unless they have been changed to “inactive”) to ensure that projects can be selected in future meetings.

    My company would like to be able to select an item from the active list and use the name of the project to create a new record where they can write quick notes from the weekly staff meetings.

    A new record in the agenda form would be created for each week’s staff meeting, and the same process would be repeated for subsequent meetings.

    Hope that helps to clear up some questions.

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    Nothing in your clarification changes what has already been said. You don't need a second table to do this.
    That is unless you intend to have several Notes records for the same project in which case you need a second table with three fields: NotesID (PK), ProjectID (FK) & Notes.
    A one to many join will link the 2 tables.
    Having said that, if the Notes field is memo / long text datatype, you can still do this in one table by using its column history property as an alternative approach.
    For more info, see http://www.mendipdatasystems.co.uk/c...lds/4594523656
    Last edited by isladogs; 08-02-2019 at 01:45 AM. Reason: Added detail and link to answer
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Well, I see you are using Reserved Words, i.e. Type and Category as field names in your tables. This is bound to confuse Access which MIGHT explain the issue you are having. You will want to fix that. For a complete list of reserved words see...

    http://allenbrowne.com/AppIssueBadWord.html


    http://www.utteraccess.com/forum/Acc...s-t539419.html

  7. #7
    jshaw1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2019
    Posts
    8
    isladogs, thanks! I'll take a look at that as I think that could help.

    GinaWhipp, those were just placeholders for the actual names of the tables/queries to redact information. Thanks for that though!

  8. #8
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    GinaWhipp, those were just placeholders for the actual names of the tables/queries to redact information. Thanks for that though!
    Good news! Can't be too careful.

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    Which of my suggestions did you think looked useful?
    Think carefully before using column history. It does have disadvantages as explained in my article
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    jshaw1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2019
    Posts
    8
    Apologies for relative inactivity - I was out of town for the weekend. I think that the column history option would make the most sense as the data is stored as a memo. Thanks for your help!

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    OK as long as you are aware of the issues before you start.
    Good luck.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Moving Subform Data
    By Lewis825 in forum Access
    Replies: 2
    Last Post: 03-02-2016, 07:32 AM
  2. Replies: 1
    Last Post: 03-31-2015, 05:17 AM
  3. Replies: 3
    Last Post: 02-24-2013, 02:32 PM
  4. Replies: 3
    Last Post: 09-19-2012, 07:34 AM
  5. Moving focus out of the subform
    By injanib in forum Forms
    Replies: 6
    Last Post: 06-20-2011, 03:45 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