Results 1 to 8 of 8
  1. #1
    DanT is offline Novice
    Windows 11 Office 365
    Join Date
    Sep 2022
    Posts
    23

    On click macro from datasheet subform


    Hi there, I'm trying to set up 'on double click' macro fired from subform that is in datasheet mode. The main form is contact manager with title header, 'add new' button and a list of all existing contacts as a subform in datasheet view. I want to open particular contact in separate form by double clicking on it. I managed to set this up working well when the embedded list is opened as a separate datasheet form but when using the main form, program asks me to manually enter ContactID value. Any idea how can I make this work? I really like datasheet representation as it has all the filtering options built in.
    Last edited by DanT; 12-02-2022 at 05:02 AM. Reason: Please move if raised in wrong place

  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,537
    Can you post a copy of the db, even with no records or just a couple of fictitious records
    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Put the macro in a button on the master form.

  4. #4
    DanT is offline Novice
    Windows 11 Office 365
    Join Date
    Sep 2022
    Posts
    23
    Hi Bob, my database is SQL backended so I'm affraid it won't work. I made a screen shot for you though. I work on real life data so had to delete a chunk of it but you should get an idea what's going on
    Attached Thumbnails Attached Thumbnails Screenshot 2022-12-02 131636.png  

  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,537
    Put a textbox in the Header of the main form. Call it txtID Set its Visible property to No. Set its Control Source property to =[NameOfMainForm].[Form]![ID]
    Substitute NameOfMainForm with the name of your main form. Be sure to include the "="

    Set the where condition of your macro to: [ID]=[Forms]![NameOfMainForm]![txtID]
    Substitute NameOfMainForm with the name of your main form.

    Like many members here, I use VBA code rather than macros but I've tried this and it seems to work for me. I hope it does for you too but post back if you need to.
    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
    DanT is offline Novice
    Windows 11 Office 365
    Join Date
    Sep 2022
    Posts
    23
    I took a couple of tweaks but works like a charm. Thank you very much Bob!

  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,537
    Quote Originally Posted by DanT View Post
    I took a couple of tweaks but works like a charm. Thank you very much Bob!
    Always glad to help if I can.

    What tweaks were needed?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    DanT is offline Novice
    Windows 11 Office 365
    Join Date
    Sep 2022
    Posts
    23
    Quote Originally Posted by Bob Fitz View Post
    Always glad to help if I can.

    What tweaks were needed?
    Just to adjust the code to my naming structure, the idea itself is immaculate

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

Similar Threads

  1. Replies: 1
    Last Post: 12-05-2016, 02:23 PM
  2. Replies: 4
    Last Post: 05-23-2014, 09:51 AM
  3. Replies: 2
    Last Post: 10-09-2013, 05:45 PM
  4. Replies: 8
    Last Post: 08-26-2012, 11:11 PM
  5. Replies: 3
    Last Post: 02-23-2012, 04:48 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